Tuesday, December 13, 2011

Google Analytics Enhancements for Mobile Apps

November was a busy time in Google Analytics. In particular, the Mobile App Tracking Team has a few things to announce.

  • EasyTracking Library - automatic session management, better integration with Google Analytics SDK
  • Updated Google Analytics SDK - More reliable method for sending hits, Android Market referral issue fixed, available via the Android SDK manager
  • More samples - new open source application aimed to help reduce the ramp up time for new developers who want to track their apps

EasyTracker Library
We’ve created EasyTracker libraries for both iOS and Android.  The EasyTracker library will enable tracking of your application down to the Activity (or UIViewController for iOS) level with almost no coding required on your part.  See the ReadMe file and source code for details. These Libraries are intended for use with the standard Google Analytics SDKs and should make it very easy to add standard tracking to your applications.

Another advantage to using the EasyTracker library is session management.  As many developers know, it’s not always easy to determine whether your application is active and when to start a new session.  The EasyTracker library handles this for you.  It will determine when your application has been put into the background and will start a new session automatically.

The Android version of the Library not only provides for easy tracking, but also ensures that all calls to GoogleAnalyticsTracker are done off the main UI Thread.  Using this library should address responsiveness issues some Android developers have seen using the Google Analytics SDK.

We’ve adapted the Android Notepad sample application to use the EasyTracker library, just to show you how easy it can be.

You can find the libraries and sample applications at
http://code.google.com/p/analytics-api-samples/.  Check the downloads section for the libraries.  The source for the libraries is available in subversion as well.  Drill down into trunk/src/tracking/mobile/android/EasyTracker for Android and trunk/src/tracking/mobile/ios/EasyTracker for iOS.  The Notepad sample application is there as well.  We’ve released them as open source and contributions to making them better are welcome.

Check the ReadMe files in the libraries themselves for more information on how to use them.

New Versions of Google Analytics SDK for Android and iOS
We’ve released version 1.4 for iOS and version 1.4.2 for Android.  The iOS version of the SDK has one new feature.  Both versions contain several bug fixes as well.  Read on for details.

iOS
We’ve added a new method, dispatchSynchronously, that blocks while it dispatches hits.  It won’t return until the hits sent have either been acknowledged by the Google Analytics servers or the specified timeout period has elapsed.  This provides a more reliable method for sending hits before your application terminates or goes into the background.

We’ve also addressed several memory leaks and crashes reported against the SDK.

More details on the new version of the SDK can be found at http://code.google.com/apis/analytics/docs/mobile/ios.html.

Android
The Android SDK will now handle referrals from the Android Market properly.  This applies to autotagging as well.

We’ve fixed several other bugs in the Android SDK.  Check out the details at http://code.google.com/apis/analytics/docs/mobile/android.html.

Google Analytics SDK now available via the Android SDK Manager
We’ve added the Google Analytics SDK to the Android SDK Manager.  You can download the latest versions using the Android SDK Manager instead of checking the website for updates.

Of course, this only applies to the Android version of the SDK.

MobilePlayground
We’ve released an open source application for both iOS and Android that exercises all the APIs for Google Analytics that are available to Mobile Application developers.  You can find them at trunk/src/tracking/mobile.

New Home for the Mobile Tracking Documentation
The Mobile Tracking documentation has moved.  It now resides with the rest of the Google Analytics tracking documentation.  Check it out at http://code.google.com/apis/analytics/docs/mobile/overview.html.

Reporting Problems and Feature Requests
We really value your feedback. If you are having problems with the SDKs, let us know by posting them on the Google Analytics issues website at http://code.google.com/p/analytics-issues/issues/list.  Use the component MobileTracking when entering an issue or looking through the list for issues already reported against the Mobile App SDKs.

Please stay tuned for more exciting news regarding Mobile Application Tracking with Google Analytics.

Jim Cotugno, Mobile Application Tracking Rockstar