Code Monkey home page Code Monkey logo

ane-google-analytics's Introduction

ANE-Google-Analytics: AIR Native Extension for Google Analytics on iOS and Android

This is an Air native extension for Google Analytics on the iOS and Android platforms.

NOTE The current release of the extension supports the new Application profile for Google Analytics.

Introduction

The Google Analytics Platform lets you measure user interactions with your business across various devices and environments.
This extension for AIR applications leverages the Android and iOS native SDKs provided by Google Analytics, exposing their features through a common API that can be used seamlessly on both platforms.

This extension makes it easy for developers to collect user engagement data from their apps.
Developers can then use Google Analytics reports to measure:

  • The number of active users are using their applications.
  • From where in the world the application is being used.
  • Adoption and usage of specific features.
  • In-app purchases and transactions.
  • The number and type of application crashes.
  • And many other useful metrics.

Usage

First of all, add the NativeGATracker.ane to your project.
Then you should check if the library is supported, get an instance of the tracker, start a tracking session using your Analytics ID and actually track something.

The code below shows the most basic example:

	import eu.alebianco.air.extensions.analytics.Analytics;
    import eu.alebianco.air.extensions.analytics.api.ITracker;

	if (Analytics.isSupported()) {
		var analytics:Analytics = Analytics.getInstance();
        var tracker:ITracker = analytics.getTracker(ANALYTICS_ID);

        // Track a page view
        tracker.buildView("Home").track();

        // Track an event
        tracker.buildEvent("click", "button").withLabel("play").withValue(10).track();
        tracker.buildEvent("click", "button").withLabel("stop").track();
        tracker.buildEvent("swipe", "screen").withValue(1).track();
        tracker.buildEvent("app", "quit").track();

        // Track an exception
        tracker.buildException(false).withDescription("ok, an error occurred, but it wasn't that bad").track();
        tracker.buildException(true).withDescription("panic! this shit is hitting the fan!").track();
        tracker.buildException(false).track();

        // Track a timer
        tracker.buildTiming("loading", 5000).withName("resources").withLabel("audio.mp3").track();
        tracker.buildTiming("waiting", 1000).track();

        // Track a social interaction
        tracker.buildSocial("GooglePlus", "+1").forContent("http://alessandrobianco.eu").track();
        tracker.buildSocial("Facebook", "like").track();

        // Track an ecommerce transaction
        tracker.buildTransaction(UIDUtil.createUID(), 10.5)
                .withAffiliation("In-App Purchase")
                .withTaxCost(0.5)
                .createProduct("cr-300", "300 credits pack", 7, 1).inCategory("credits").add()
                .createProduct("it-156", "extra life item", 1.5, 2).add()
                .track();
	}

The first iteration of the demo project ANE-Google-Analytics-Demo is now complete. Its purpose is to showcase the basic project setup and the features of the extension.
As a first iteration, only screens and events tracking are implemented and enabled. Over time I'll complete it by adding more tracking options to fully exploid the extension.

Building

Requirements:

  • Adobe Air SDK 3.5 or later
  • XCode IDE, iOS SDK 5.1 or later
  • Google Android SDK 2.2

Add the FlashRuntimeExtensions.h file from the Adobe Air SDK to the source/ios/Libraries folder
Add the FlashRuntimeExtensions.jar file from the Adobe Air SDK to the source/android/libs folder
In the build folder, make a copy of the user.properties.eg file and call it user.properties
Edit that file to provide values specific to your system
Use the build.ant ant script you'll find in the build folder, to build the project

Contributing

If you want to contribute to the project refer to the CONTRIBUTING.md document for guidelines.

Roadmap

You can follow the project planning on Trello, you can even vote for the tasks that are more important for you and you'll like to see implemented.

ane-google-analytics's People

Contributors

alebianco avatar

Watchers

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