/Titanium-Count.ly

Titanium Count.ly SDK Module

Primary LanguageObjective-CMIT LicenseMIT

Count.ly Titanium iOS SDK

Countly is an innovative, real-time, open source mobile analytics application. It collects data from mobile phones, and visualizes this information to analyze mobile application usage and end-user behavior. There are two parts of Countly: the server that collects and analyzes data, and mobile SDK that sends this data (for iOS & Android).

Countly Server;

Other Countly SDK repositories;

Installation

Clone git repo and move to Titanium Modules Folder

$ git clone https://github.com/euforic/Ti-Count.ly.git
$ cd Ti-Count.ly
$ cp count.ly-iphone-0.3.1.zip /Library/Application Support/Titanium/

Register your module with your application by editing tiapp.xml and adding your module.

<modules>
  <module version="0.3.1">count.ly</module>
</modules>

Usage

Start Count.ly

Start Tracking

var countly = require('count.ly');
countly.start('APP_KEY','http://API_HOST.com');

Record Events

Set any of the following Fields in an Object

var segmentation = {device:"iPhone 4S", country:"USA"};
var eventData = {name: "keySegmentationCountSum", segmentation:segmentation, count: 1, sum: 0.99};

  • name (required) : Name of the event to track
  • (example - Track clicks on the help button "clickedHelp" )
  • count (required) : Number to increment the event in the db
  • (example - User purchases item increment by 1 )
  • sum : If the event is tied to an overall numerical data, such as a purchase, we can use sum to keep track of that
  • (example - 0.99)
  • segmentation : Categorization of the event
  • (example - User is from USA and uses an iPhone 4S so the segmentation will be {device:"iPhone 4S", country:"USA"} )

Track Events Examples

var segmentation = {device:"iPhone 4S", country:"USA"};

Ti.API.log("Send keyCount Event");
var eventData = {name: "keyCount", count: 1};
Countly.event(eventData);

Ti.API.log("Send keyCountSum Event");
var eventData = {name: "keyCountSum", count: 1, sum: 0.99};
Countly.event(eventData);

Ti.API.log("Send keySegmentationCount Event");
var eventData = {name: "keySegmentationCount", segmentation:segmentation, count: 1};
Countly.event(eventData);

Ti.API.log("Send keySegmentationCountSum Event");
var eventData = {name: "keySegmentationCountSum", segmentation:segmentation, count: 1, sum: 0.99};
Countly.event(eventData);

Set UserData

Set any of the following Fields in an Object

**Set userData{} as information about user **Possible keys are:

  • name - (String) providing user's full name
  • username - (String) providing user's nickname
  • email - (String) providing user's email address
  • organization - (String) providing user's organization's name where user works
  • phone - (String) providing user's phone number
  • picture - (String) providing WWW URL to user's avatar or profile picture
  • picturePath - (String) providing local path to user's avatar or profile picture
  • gender - (String) providing user's gender as M for male and F for female
  • byear - (int) providing user's year of birth as integer
var userData = {	name: "testName",
username: "testUsername",
email: "testemail@gmail.com",
organization: "testOrg",
phone: "testPhone",
picture: "https://count.ly/wp-content/uploads/2014/10/logo.png",
picturePath: "/images/appicon.png",
gender: "M",
byear: "1980",
};

**Set customUserData{} as information about user with custom properties **In customUserData you can provide any string key values to be stored with user

var customUserData = {	key1: "value1",
key2:"value2",
};

**Set Userdata as set in userData and customData **Can contain both userData and customData - or just userdata

Ti.API.log("Set UserData");
var args = {	userData:userData,
customUserData:customUserData,
};


Countly.userData(args);

Metrics Data

console.log('device',countly.device);
console.log('deviceName',countly.deviceName);
console.log('devicePlatform',countly.platform)
console.log('multitaskingSupported',countly.multitaskingSupported);
console.log('orientation', countly.orientation);
console.log('osVersion', countly.osVersion);
console.log('carrier', countly.carrier);
console.log('resolution', countly.resolution);
console.log('locale',countly.locale);
console.log('appVersion',countly.appVersion);
console.log('osVersion',countly.osVersion);

License

(The MIT License)

Copyright (c) 2015 Christian Sullivan <cs@bodhi5.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.