Skip to content

Commit

Permalink
Android/Analytics setCutstomVar documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robdiciuccio committed Nov 9, 2012
1 parent 5fb8d51 commit b66b2a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Android/Analytics/2.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Sample use:

Sample use:

window.plugins.analytics.setCustomVar(1, "type", "android", 0, function(){alert("SetVar: success");}, function(){alert("SetVar: failure");});
window.plugins.analytics.setCustomVar(1, "type", "android", null, function(){alert("SetVar: success");}, function(){alert("SetVar: failure");});

Please keep in mind that these methods, as in any other plugin, are ready to be invoked only after '[deviceready](http://docs.phonegap.com/phonegap_events_events.md.html#deviceready)' event has been fired
Good practice will be manual dispatch and stop session. Add this code to your main activity:
Expand Down
11 changes: 11 additions & 0 deletions Android/Analytics/2.0/www/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ Analytics.prototype.trackEvent = function(category, action, label, value, succes
]);
};

/**
* Set a custom variable on Google Analytics
* @param index The slot for the custom variable
* @param label The name for the custom variable
* @param value The value for the custom variable
* @param scope The scope for the custom variable (optional)
* @param successCallback The success callback
* @param failureCallback The error callback
*/

Analytics.prototype.setCustomVar = function(index, label, value, scope, successCallback, failureCallback){
return cordova.exec(
successCallback,
Expand Down

0 comments on commit b66b2a4

Please sign in to comment.