mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-01 11:50:54 +08:00
expanded upon event API
This commit is contained in:
@@ -23,6 +23,16 @@ describe('UniversalAnalytics', () => {
|
||||
ga('create', 'UA-65432-1', 'auto', {some: 'config'});
|
||||
ga('send', 'pageview');
|
||||
ga('send', 'pageview', {some: 'details'});
|
||||
ga('send', 'event', 'Videos', 'play', 'Fall Campaign');
|
||||
ga('send', {hitType: 'event', eventCategory: 'Videos', eventAction: 'play', eventLabel: 'Fall Campaign'});
|
||||
ga('send', 'event', 'Videos', 'play', 'Fall Campaign', {nonInteraction: true});
|
||||
ga('send', 'pageview', '/page');
|
||||
ga('send', 'social', {'socialNetwork': 'facebook', 'socialAction': 'like', 'socialTarget': 'http://foo.com'});
|
||||
ga('send', 'social', {'socialNetwork': 'google+', 'socialAction': 'plus', 'socialTarget': 'http://foo.com'});
|
||||
ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123});
|
||||
ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123, 'timingLabel': 'label'});
|
||||
ga('trackerName.send', 'event', 'load');
|
||||
|
||||
ga.create('UA-65432-1', 'auto');
|
||||
ga.create('UA-65432-1', {some: 'config'});
|
||||
ga.create('UA-65432-1', 'auto', {some: 'config'});
|
||||
|
||||
Vendored
+34
-1
@@ -36,15 +36,48 @@ interface GoogleAnalytics {
|
||||
async: boolean;
|
||||
}
|
||||
|
||||
enum HitType {
|
||||
'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'
|
||||
}
|
||||
|
||||
declare module UniversalAnalytics {
|
||||
// https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference
|
||||
|
||||
interface ga {
|
||||
l: number;
|
||||
q: any[];
|
||||
|
||||
(command: 'send', hitType: 'event', eventCategory: string, eventAction: string,
|
||||
eventLabel?: string, eventValue?: number, fieldsObject?: {} ): void;
|
||||
(command: 'send', hitType: 'event', fieldsObject: {
|
||||
eventCategory: string
|
||||
eventAction: string,
|
||||
eventLabel?: string,
|
||||
eventValue?: number,
|
||||
nonInteraction?: boolean}): void;
|
||||
(command: 'send', fieldsObject: {
|
||||
hitType: 'event',
|
||||
eventCategory: string
|
||||
eventAction: string,
|
||||
eventLabel?: string,
|
||||
eventValue?: number,
|
||||
nonInteraction?: boolean}): void;
|
||||
(command: 'send', hitType: 'pageview', page: string): void;
|
||||
(command: 'send', hitType: 'social',
|
||||
socialNetwork: string, socialAction: string, socialTarget: string): void;
|
||||
(command: 'send', hitType: 'social',
|
||||
fieldsObject: {socialNetwork: string, socialAction: string, socialTarget: string}): void;
|
||||
(command: 'send', hitType: 'timing',
|
||||
timingCategory: string, timingVar: string, timingValue: number): void;
|
||||
(command: 'send', hitType: 'timing',
|
||||
fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void;
|
||||
(command: 'send', hitType: HitType, ...fields): void;
|
||||
(command: 'send', fieldsObject: {}): void;
|
||||
|
||||
(command: string, hitDetails: {}): void;
|
||||
(command: string, poly: string, opt_poly?: {}): UniversalAnalytics.Tracker;
|
||||
(command: string, trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker;
|
||||
(command: string, hitDetails: {}): void;
|
||||
|
||||
create(trackingId: string, opt_configObject?: {}): UniversalAnalytics.Tracker;
|
||||
create(trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker;
|
||||
getAll(): UniversalAnalytics.Tracker[];
|
||||
|
||||
Reference in New Issue
Block a user