Last active
December 16, 2015 08:18
-
-
Save joshjensen/5404361 to your computer and use it in GitHub Desktop.
Cross-platform Appcelerator Titanium example for Count.ly
This file contains 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 apiKey = "ENTER YOUR COUNTLY KEY HERE"; | |
var countly = null; | |
var isAndroid = (Ti.Platform.osname === 'android'); | |
if (isAndroid) { | |
countly = require('ly.count'); | |
countly.countInit(VARS.GV.statsServer, apiKey); | |
} else { | |
countly = require('count.ly'); | |
countly.start(apiKey, VARS.GV.statsServer); | |
} | |
exports.event = function(_args) { | |
if (isAndroid) { | |
countly.sendEvent(_args.name, _args.count); | |
} else { | |
countly.event(_args); | |
} | |
}; |
This file contains 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
Install required modules | |
Android - https://github.com/shivakumars/Titanium-Android-Count.ly/blob/master/dist/ly.count-android-0.1.zip | |
iOS - https://github.com/euforic/Titanium-Count.ly/blob/master/count.ly-iphone-0.2.1.zip | |
To use the modules you can use this example: | |
var countly = require('analytics'); | |
countly.event({ | |
name: 'App | Installed' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment