• This repository has been archived on 13/Sep/2021
  • Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 11 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Google Analytics Native SDK modules for Titanium

Ti.GA

A Google Analytics module that provides just what you need, in a consistent way.

This module was developed as a result of the frustration in chasing Google's changing API between SDK versions. Since most developers only care about a few features of the SDK that is what this module provides.

Downloads

Download the compiled modules at:

Source

Looking for the source? Check out the following:

How to...

Android specifications

If you use ti.playservices, you need to remove the /lib folder in the Android zip module.

Also you need to edit the android manifest, in tiapp.xml, as specified in the Google Analytics dev guide:

<android xmlns:android="http://schemas.android.com/apk/res/android">
  <manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application>
      <!-- Get permission for reliable local dispatching on non-Google Play devices. -->
      <uses-permission android:name="android.permission.WAKE_LOCK"/>

      <!-- Optionally, register AnalyticsReceiver and AnalyticsService to support background dispatching on non-Google Play devices -->
      <receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver" android:enabled="true">
        <intent-filter>
          <action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH"/>
        </intent-filter>
      </receiver>
      <service android:name="com.google.android.gms.analytics.AnalyticsService" android:enabled="true" android:exported="false"/>

      <!-- Optionally, register CampaignTrackingReceiver and CampaignTrackingService to enable installation campaign reporting -->
      <receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver" android:exported="true">
        <intent-filter>
          <action android:name="com.android.vending.INSTALL_REFERRER"/>
        </intent-filter>
      </receiver>
      <service android:name="com.google.android.gms.analytics.CampaignTrackingService"/>
    </application>
  </manifest>
</android>

Add to your project

You add the Ti.GA module into your project using the require keyword as shown below.
var ga = require('ti.ga');

Module Level Options

Enable Trace You can enable or disable trace by calling ga.setDebug. Provide true to enable or false to disable this option.

The following shows how to enable this feature

ga.setDebug(true);

OptOut Google Analytics provides the ability to opt out of collecting information. By default you are opt'ed into collecting information.

The following is an example on how to optout of collecting information:

ga.setOptOut(false);

If you have at one point opt'ed out you need to explicitly opt back in. Below is an example of opt'ing into collecting information:

ga.setOptOut(true);

setDispatchInterval The dispatch interval is how often in seconds that Google Analytics information should be submitted to Google.

The following show how to set the dispatch interval to 15 seconds.

ga.setDispatchInterval(15);

setTrackUncaughtExceptions On iOS you can set use the setTrackUncaughtExceptions to track unhandled exceptions.

The following is an example on how to enable this feature.

ga.setTrackUncaughtExceptions();

Dispatch The dispatch method submits data to Google Analytics. Google Analytics will automatically do this for your, but you can "force" this programmatically. If you are going to use this it should only be done while your application is not active and has a network connection.

ga.dispatch();

Creating a tracker

~~~ var tracker = ga.createTracker({ trackingId:'YOUR GOOGLE ANALYTICS TRACKER ID', useSecure:true, debug:true }); ~~~

Adding User ID

If you want to associate user IDs with your analytics data, you'll first need to create a view with User ID enabled.

Then, when a user logs in, pass a unique identifier for that user with the setUserID method on the tracker. You only need to set this once, and all hits for the session from then on will be attributed to that ID.

tracker.setUserID('my-user-id');

Adding Screen Viewed

More coming... here is an example for now

tracker.addScreenView('my-cool-view2');

Adding Timing

More coming... here is an example for now

    tracker.addTiming({
        category:"myCategory-Timing",
        label:"myLabel",
        name:"myName",
        time:1
    });

Adding Event

More coming... here is an example for now

    tracker.addEvent({
        category:"myCategory-Event",
        action:"myAction",
        label:"myLabel",
        value:1
    });  

Adding Social Network

More coming... here is an example for now

    tracker.addSocialNetwork({
        network:"facebook",
        action:"myAcount",
        target:"myTarget"
    });  

Adding Exception

More coming... here is an example for now

    tracker.addException({
        description:"my error description",
        fatal:false
    });  

Contributors

Thank you to all of the contributors.

A special thank you to Mauro Piccotti for helping to address Google Play conflicts

Licensing & Support

This project is licensed under the OSI approved Apache Public License (version 2). For details please see the license associated with each project.

Developed by Ben Bahrenburg available on twitter @bencoding

More Repositories

1

Ti.BlurView

A Blur View implementation for Titanium
Objective-C
161
star
2

Securely

Security Modules for Titanium Mobile
Objective-C
134
star
3

awesome-calendars

A list of awesome calendar components
100
star
4

benCoding.AlarmManager

Titanium Module for working with the Android AlarmManager
Java
98
star
5

Ti.SQ

Titanium native module allowing you to use Square's TimeSquare date picker in your Titanium iOS & Android app
Java
88
star
6

LocalNotify

Extends & provides helpers for Titanium Mobile's LocalNotifications
Objective-C
75
star
7

benCoding.BasicGeo

Titanium Geo Location Module
Objective-C
75
star
8

Utterance

Utterance lets you use the platform's native Text To Speech Engine within your Titanium Project
Java
71
star
9

benCoding.Android.Tools

A collection of utilities designed to make working with Titanium on Android alittle easier.
Java
60
star
10

Ti.Wormhole

Enabling Titanium style events between your Titanium iOS app and iOS Extensions & the Apple Watch
Objective-C
50
star
11

ti.mely

Ti.mely Native Timers for Titanium Mobile
Makefile
49
star
12

Ti.SevenSwitch

iOS 7 switch for Titanium
Objective-C
42
star
13

benCoding.Map

Titanium Map View Module with Polygon Support
JavaScript
40
star
14

benCoding.iOS.Tools

Tools to make working with Titanium on iOS even easier.
Objective-C
39
star
15

Ti.Geo.Background

Titanium Background Geo Location
JavaScript
37
star
16

TiNetworkHelpers

Titanium Module with additional network functionality
Python
35
star
17

bARk

Titanium Augmented Reality Sample App
JavaScript
34
star
18

Ti.JBChart

Titanium wrapper for JBChartView
Objective-C
30
star
19

benCoding.SMS

SMS Dialog Module for Titanium Mobile
Objective-C
29
star
20

Atlas

Location Library For Titanium Mobile
JavaScript
29
star
21

TiTaffyDb

Example project for a Titanium port of TaffyDb
JavaScript
28
star
22

benCoding.PDF

Titanium module to make working with PDFs easier
Python
26
star
23

Ti.CoreMotion

Surfacing a few CoreMotion components to Titanium Mobile
Python
24
star
24

Ti.Queue

Queueing in Titanium made easy - CommonJS module
JavaScript
22
star
25

Ti.GeoVisits

Titanium access to CoreLocation's visit event
Objective-C
21
star
26

Ti.iSpeech

iSpeech.org module for Titanium mobile
Objective-C
19
star
27

Soup

CommonJS formated Geo Search Providers for Appcelerator Titanium
JavaScript
16
star
28

Ti.Geocoder

Native Geocoders for Titanium mobile
Java
16
star
29

benCoding.Stepper

Titanium Stepper Control Module
Python
15
star
30

Ti.Passcode

Cross-platform passcode implementation for Titanium mobile
JavaScript
14
star
31

Ti.Light

Titanium Flashlight example module
Python
14
star
32

SentimentlySwift

Sentiment Analysis Swift Playground
Swift
13
star
33

Ti.SpeechKit

Titanium module to allow access to SpeechKit by Naunce
Objective-C
13
star
34

SpinningImageView-Example

Example on how to create a spinning UIImageView using Swift
Swift
12
star
35

Ti.Safari.ReadingList

Titanium module to add items to the Safari Reading List
Python
12
star
36

TiGroupon

JavaScript
10
star
37

Ti.OneTok

Titanium Modules for Ti.OneTok
Objective-C
9
star
38

benCoding.QuickLook

Titanium Module for iOS QuickLook
Objective-C
9
star
39

Ti-Google-Play-Services

Shell
8
star
40

benCoding.Dictionary

Titanium Dictionary Module for iOS5+
Objective-C
8
star
41

Ti.SlowAES

Titanium CommonJS module for using SlowAES
JavaScript
8
star
42

Ti.WebWorkerWrapper

Web Worker Wrapper for Titanium
JavaScript
8
star
43

Ti.HUD.js

Titanium Cross-platform HUD / Progress Indicator Examples
JavaScript
7
star
44

Dossier

Makes moving and copying Titanium Directories easy
JavaScript
7
star
45

TiColorPickerExample

Color Picker Example
JavaScript
7
star
46

Ti.Geocoder.Offline

Offline Geocoder for Titanium
Objective-C
7
star
47

Zipper

Titanium Mobile Zip File Utility
C
6
star
48

KeyStorage

KeyStorage is a simple secure key persistance library written in Swift.
Swift
6
star
49

PDFUtilities

PDFUtilities makes working with PDFs in Swift easier.
Shell
6
star
50

Permissions

Permissions checking for Titanium iOS
Python
6
star
51

Ti.Brightness

Screen Brightness helper methods for Titanium iOS
Python
6
star
52

ImageViewTintImage-Example

Example how to tint a UIImageView UIImage
Swift
5
star
53

benCoding.Switch

Titanium module wrapper for DCRoundSwitch
Objective-C
5
star
54

SwiftyBeaver-GA-Exception-Logger

Google Analytics plugin for SwiftyBeaver
Swift
4
star
55

UserProperties

Simplify Swift access to NSUserDefaults
Swift
4
star
56

codefab2011

Appcelerator Presentation For CodeFab 2011
4
star
57

Pinger

Ping Library for Titanium Mobile
Objective-C
2
star
58

Playgrounds

Experiments & blog posts
Swift
2
star
59

Ti.GeoProviders

Geo Providers for Titanium
JavaScript
2
star
60

Ti.Geo.Availability

Availability Checks for Titanium Geo
Makefile
2
star
61

BucketList

Need caching? Focused on security? BucketList makes working with encrypted caching easy. Also supports stand your standard key value caching as well.
Swift
2
star
62

benbahrenburg

1
star
63

Doorman

Ridiculously simple, sampling and control flow for Swift
Swift
1
star
64

Ti.Security.JailBroken

Security module for Titanium iOS. Detect if device is jail broken
Objective-C
1
star
65

GeoJSON-Mix

Just a few geojson files....
1
star
66

Reachify

Simple Network Reachability in Swift
Swift
1
star
67

QnABotMaker

Convenience library for working with Microsoft QnA Maker Service
Swift
1
star
68

Ti.Geo.LocationMonitor

Location Manager Helpers for Titanium
Makefile
1
star
69

Ti.Geo.SignificantChange

Location Significant Change module for Titanium
Makefile
1
star