mirror of
https://github.com/purplecabbage/phonegap-plugins.git
synced 2026-01-13 08:28:02 -05:00
37 lines
1.2 KiB
JavaScript
Executable File
37 lines
1.2 KiB
JavaScript
Executable File
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:isNaN(parseInt(value)) ? -1 : 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();
|
|
});
|