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. 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. Sign up for an account
• Sign up for Google Analytics if you don't 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. http://mymobapp.mywebsite.com)".
Whatever you choose is entirely up to you.
• Write the UA or go back to your profile page to access it.
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. Add permissions
• Add the following permissions to your
AndroidManifest.xml file.
android.permission.INTERNET
android.permission.ACCESS_NETWORK_STATE
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 to
call dispatch() to fire off the tracking events. This call is not
required if you passed a time interval to the start call.
mAnalyticsTracker.dispatch();
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 that
you created.
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 help
screen, we simply pass HelpScreen.
mAnalyticsTracker.trackPageView("/HelpScreen");
*The string value passed to trackPageView is entirely up to
you.
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’s
category, an action, a label, and a value. In the Google
Analytics interface events are grouped by categories, and
additionally may contain per-event labels
11. How to use it ?
• Finally, remember to stop the tracker when you no longer
need it's services.
mAnalyticsTracker.stop();
*usually called in your onDestroy()
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. Lastly check the Dashboard
• Log in to Google Analytics website and see what is
happening.
14. Done!
• For more info visit:
Android -
https://developers.google.com/analytics/devguides/collection/android/
IOS - https://developers.google.com/analytics/devguides/collection/ios/
General –
https://developers.google.com/mobile/articles/analytics_end_to_end