Created
March 7, 2013 18:33
-
-
Save psousa/5110510 to your computer and use it in GitHub Desktop.
GoogleAnalitycs sdk Titanium example initializer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myAPP = {}; | |
Ti.include('windows/gallery.js'); | |
(function() { | |
myAPP.setupAnalytics=function(){ | |
var GoogleAnalytics = require('com.thinkorange.google.analytics'); | |
GoogleAnalytics.accountID = "UA-xxxxxx-1"; | |
GoogleAnalytics.debug = true; | |
GoogleAnalytics.trackUncaughtExceptions = true; | |
myAPP.tracker= GoogleAnalytics.tracker; | |
myAPP.tracker.anonymize = true; | |
myAPP.tracker.sampleRate = 10; | |
}; | |
myAPP.setupApp= function(){ | |
myAPP.setupAnalytics(); | |
Titanium.UI.setBackgroundColor('#000000'); | |
var baseWin = Titanium.UI.createWindow({ | |
title: 'My Awesome app', | |
width: Ti.Platform.displayCaps.platformWidth, | |
height: Ti.Platform.displayCaps.platformHeight, | |
backgroundColor:'#000' | |
}); | |
var galleryWin = myAPP.setup(); | |
myAPP.navGroup = Ti.UI.iPhone.createNavigationGroup({window:galleryWin}); | |
baseWin.add(myAPP.navGroup); | |
baseWin.open(); | |
baseWin.addEventListener('open', function(){ | |
Ti.API.warn('open baseWin! '); | |
myAPP.tracker.trackEvent({ | |
category: 'app', | |
action : 'init', | |
label : 'test_init_open', | |
value : 2 | |
}); | |
}); | |
}; | |
})(); | |
//win! | |
myAPP.setupApp(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment