Code Monkey home page Code Monkey logo

ti.ga's Introduction

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...

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 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",
        value: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
    });  

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

ti.ga's People

Contributors

benbahrenburg avatar fokkezb avatar joshjensen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.