-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoogleAnalyticsPlugin.js
executable file
·36 lines (30 loc) · 1.15 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
function GoogleAnalyticsPlugin() {}
GoogleAnalyticsPlugin.prototype.startTrackerWithAccountID = function(id) {
cordova.exec("GoogleAnalyticsPlugin.startTrackerWithAccountID",id);
};
GoogleAnalyticsPlugin.prototype.trackPageview = function(pageUri) {
cordova.exec("GoogleAnalyticsPlugin.trackPageview",pageUri);
};
GoogleAnalyticsPlugin.prototype.trackEvent = function(category,action,label,value) {
var options = {category:category,
action:action,
label:label,
value:value};
cordova.exec("GoogleAnalyticsPlugin.trackEvent",options);
};
GoogleAnalyticsPlugin.prototype.setCustomVariable = function(index,name,value) {
var options = {index:index,
name:name,
value:value};
cordova.exec("GoogleAnalyticsPlugin.setCustomVariable",options);
};
GoogleAnalyticsPlugin.prototype.hitDispatched = function(hitString) {
//console.log("hitDispatched :: " + hitString);
};
GoogleAnalyticsPlugin.prototype.trackerDispatchDidComplete = function(count) {
//console.log("trackerDispatchDidComplete :: " + count);
};
cordova.addConstructor(function() {
if(!window.plugins) window.plugins = {};
window.plugins.googleAnalyticsPlugin = new GoogleAnalyticsPlugin();
});