Skip to content

Instantly share code, notes, and snippets.

@rubenfonseca
Created July 13, 2011 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenfonseca/1081291 to your computer and use it in GitHub Desktop.
Save rubenfonseca/1081291 to your computer and use it in GitHub Desktop.
Google Analytics Module
var google_analytics = require('com.0x82.google.analytics');
google_analytics.addEventListener('complete', function(e) {
Ti.API.log(e);
});
google_analytics.startTracker({
accountID: 'UA-2061857-1',
debug: true
});
google_analytics.setCustomVariable({
index: 1,
name : "iPhone1",
value: "iv1"
});
Ti.API.log(google_analytics.getVisitorCustomVariable(1));
google_analytics.trackPageView('/app_entry_point');
google_analytics.trackEvent({
category: 'my_category',
action : 'my_action',
label : 'my_label',
value : -1
});
google_analytics.addTransaction({
orderID: '1',
storeName: "ThinkOrange",
totalPrice: 2.45,
totalTax: 0.69,
shippingCost: 1.00
});
google_analytics.addItem({
orderID: '1',
itemName: 'pair of socks',
itemSKU: 'asdfasdfadfasdf',
itemPrice: 2.45,
itemCount: 1,
itemCategory: 'category'
});
google_analytics.trackTransactions();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment