Giter Club home page Giter Club logo

titanium.ganalytics's Introduction

Titanium.GAnalytics

Google Analytics for Titanium. Without Copyright-Bullshit, use it wherever you want.

Getting started

1. Including the plugin into your Titanium project.

    Titanium.include('GATitanium.js');

2. Initialize GAnalytics with your Tracking-ID.

    var analytics = new Analytics('UA-XXXXXXXX-X');

3. Inject Firing Events.

    Titanium.App.addEventListener('analytics_trackPageview', function (e) {
    analytics.trackPageview('/iPhone' + e.p);

    // Assume every win is a pageview, that is, a page.

    });
    
    Titanium.App.addEventListener('analytics_trackEvent', function (e) {
    analytics.trackEvent(e.category, e.action, e.label, e.value);
    });
    
    Titanium.App.Analytics = {
    trackPageview: function (p) {
            Titanium.App.fireEvent('analytics_trackPageview', {
                    p: p
            });
    },
    trackEvent: function (category, action, label, value) {
            Titanium.App.fireEvent('analytics_trackEvent', {
                    category: category,
                    action: action,
                    label: label,
                    value: value
            });
    }
    }

Everything to this point should be executed before initialization. (before showing a window)

4. Fire up your Pageviews

Imagine tracking a user focusing a window.

    win1.addEventListener('focus', function (e) {
            Titanium.App.Analytics.trackPageview('/win1');
    });

… or every window of your app.

    win1.addEventListener('focus', function (e) {
            Titanium.App.Analytics.trackPageview('/win1');
    });
    win2.addEventListener('focus', function (e) {
            Titanium.App.Analytics.trackPageview('/win2');
    });
    win3.addEventListener('focus', function (e) {
            Titanium.App.Analytics.trackPageview('/win3');
    });
    win4.addEventListener('focus', function (e) {
            Titanium.App.Analytics.trackPageview('/win4');
    });
    win5.addEventListener('focus', function (e) {
            Titanium.App.Analytics.trackPageview('/win5');
    });

… your fire pageviews from UIWebViews

            Titanium.App.fireEvent("analytics_trackPageview", {p:"/win1/slider1/drag:left"});

… which tracks user interaction with a css3-slider.

5. Be creative. Track whenever a user throws your app into the air at runtime.

6. Checkout the realtime dashboard at GAnalytics. Awwwwwsum. <3.

Titanium.GAnalytics

titanium.ganalytics's People

Contributors

19h avatar

Stargazers

 avatar Alco avatar  avatar Moshe Marciano avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

bangslosan

titanium.ganalytics's Issues

Error when compile App

Hi, i have a error when initialize the code.

Script Error {
[ERROR] : backtrace = "#0 () at :0";
[ERROR] : line = 21;
[ERROR] : message = "Can't find variable: GAnalytics";
[ERROR] : name = ReferenceError;
[ERROR] : sourceId = 301325824;
[ERROR] : sourceURL = "file://localhost/Users/macbook/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/3B628160-D925-44D8-9C84-58BD8A5FA3F3/Card-BoardV1.app/alloy/controllers/index.js";
[ERROR] : }

Thanks

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.