Mobile Analytics Android


Published on

quickstart for android

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Mobile Analytics Android

  1. 1. MOBILE GOOGLEANALYTICSA Quickstart for Android Prepared by: Michael Angelo M. Rivera Date: October 25, 2012
  2. 2. What it does?• 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.• And many other useful metrics...
  3. 3. How to get it?• Download the Google Analytics library for Android in resource website (Google it). OR• Update use the Android SDK Manager to get the Google Analytics SDK. • - Check the android-sdk/extras/google /*
  4. 4. Sign up for an account• Sign up for Google Analytics if you dont already have an account.• Create a new UA, also known as a Web property ID. Once you are signed into Google Analytics you will see a drop down list in the top right corner. Select "Create new account" and follow the steps provided. Google documentation suggests "using a fake but descriptive website URL (e.g.". Whatever you choose is entirely up to you.• Write the UA or go back to your profile page to access it.
  5. 5. Add the GA library file• In Eclipse right click on your project (control + click for OSX) and select Properties. Choose Java Build Path and then select the Libraries tab. Then you will need to select the Add External JARs button and navigate to where you saved the library on your computer.
  6. 6. Add permissions• Add the following permissions to your AndroidManifest.xml file. android.permission.INTERNET android.permission.ACCESS_NETWORK_STATE
  7. 7. How to use it ?• Obtain tracker instance and start in manual mode, usually done in onCreate(Bundle savedInstanceState)mAnalyticsTracker = GoogleAnalyticsTracker.getInstance();mAnalyticsTracker.start("insert_UA", this);*If you start the tracker in manual mode you will need tocall dispatch() to fire off the tracking events. This call is notrequired if you passed a time interval to the start call. mAnalyticsTracker.dispatch();
  8. 8. How to use it ?• You can also start the tracker with a dispatch interval by specifying a seconds parameter. The following code will dispatch request every 60s. mAnalyticsTracker.start("insert_UA", 60, this);*insert_UA - is your web property ID from your profile thatyou created.
  9. 9. How to use it ?• The Google documentation suggests using trackPageView as the best way to track which areas of your application are being viewed by users. Say we want to track when the users view the helpscreen, we simply pass HelpScreen. mAnalyticsTracker.trackPageView("/HelpScreen");*The string value passed to trackPageView is entirely up toyou.
  10. 10. How to use it ?• Tracking click events:public void sayHelloButtonPressed(View v) { welcomeView.setText("Welcome, user!"); tracker.trackEvent("FirstActivity", "sayHello", "", -1);}The trackEvent ,takes four parameters: the event’scategory, an action, a label, and a value. In the GoogleAnalytics interface events are grouped by categories, andadditionally may contain per-event labels
  11. 11. How to use it ?• Finally, remember to stop the tracker when you no longer need its services. mAnalyticsTracker.stop();*usually called in your onDestroy()
  12. 12. Quick overview for iOS• Drag GANTracker.h and libGoogleAnalytics.a from the SDK’s library directory into your project.• Add the CFNetwork framework and link against libsqlite3.0.dylib.• Initialize the tracker. Since we want to start tracking impressions and events immediately, the most logical place to put this initialization is in our application’s AppDelegate. Be sure to import GANTracker.h in your implementation file• Same thing trackPageView and or trackEvents• Stop the tracker in your dealloc method:(No sample codes since, I’m not an iOS dev, so I guess you’ll understand anyway)
  13. 13. Lastly check the Dashboard• Log in to Google Analytics website and see what is happening.
  14. 14. Done!• For more info visit:Android - - –