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.
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.
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.
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
If you want to contribute to the project refer to the CONTRIBUTING.md document for guidelines.
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.