-
Notifications
You must be signed in to change notification settings - Fork 14
/
GoogleAnalyticsPlugin.js
37 lines (37 loc) · 1.09 KB
/
GoogleAnalyticsPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if (!window.GA) {
window.GA = {
trackerWithTrackingId: function(id) {
if (cordova && cordova.exec) {
cordova.exec("GoogleAnalyticsPlugin.trackerWithTrackingId",id);
} else {
console.log("would track using ID " + id);
}
//console.log("trackerWithTrackingId Initialized");
},
trackView: function(pageUri) {
if (cordova && cordova.exec) {
cordova.exec("GoogleAnalyticsPlugin.trackView",pageUri);
} else {
console.log("would track VIEW " + pageUri);
}
//console.log("trackView Initialized");
},
trackEventWithCategory: function(category,action,label,value) {
var options = {category:category,
action:action,
label:label,
value:value};
if (cordova && cordova.exec) {
cordova.exec("GoogleAnalyticsPlugin.trackEventWithCategory",options);
} else {
console.log("would track EVENT " + category+"/"+action+"/"+label+"/"+value);
}
},
hitDispatched: function(hitString) {
//console.log("hitDispatched :: " + hitString);
},
trackerDispatchDidComplete: function(count) {
//console.log("trackerDispatchDidComplete :: " + count);
}
};
}