using google analytics within an android app
DESCRIPTION
Using Google Analytics within an Android app in 3 easy stepsTRANSCRIPT
April 2nd Living Tomorrow Brussels
within Android applications/games
Quick introduction by cousinHub
[email protected]://twitter.com/cousinHub22
within Android applications/games
www.appbrain.com
Why ?
How ?
How to get started ?
For example …
within Android apps/games
Version tracking of your applications
Fun & provides better insight into your users : Map Overlay,
Content Overview, Visitors’ screen resolutions, language, etc.
Improve the application : makes it easy to see how people are
using specific parts of Android applications => feedback loop
Tracking Referrals : The Android 1.6 OS release supports the
use of a referrer URL parameter in download links to the
Android Market.
WHY ?
within Android apps/games
• As with websites, there are two basic categories of user interaction you can track: pageviews and events.
• Since mobile apps don't contain HTML pages, developers simply determine when their apps should trigger Pageview requests. Google Analytics then aggregates this data in the Content reports to display the number of visits, session length and bounce rates. The data gives insight into how your users interacted with the app.
• Developers can also track visitor actions that don't correspond directly to pageviews using Event Tracking. These user actions can include views of embedded videos, button clicks, downloads and more. App developers can then use this data to understand which features are most popular and inform decisions about which features should be promoted or prioritized for further development.
within Android apps/games
Step 1: add libGoogleAnalytics.jar to the project's /libs directory
Step 2 : create a new website profile into Analytics
Step 3 : code & don’t forget the manifest:
add the following permissions to the AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
HOW ?
within Android apps/games
Step 1
Download & unzip the Analytics SDK for Android:
http://dl.google.com/gaformobileapps/GoogleAnalyticsAndroid_0.7.zip
Add External JAR to your project :
Project> Properties> Java Build Path> Add External JARs> libGoogleAnalytics.jar
within Android apps/games
Step 2
Create a free account at www.google.com/analytics (or use your current account) and create a new website profile in that
account using a fake but descriptive website URL :
http://mymobileapp.yourANDROIDapp.com
Once you create the profile, write down or keep a copy of the web property ID that is generated for the newly-created profile :
a Web property ID is also known as the UA number of your tracking code and looks like UA-xxxxx-yy
within Android apps/games
Step 3
Let’s code ! First, obtain the tracker singleton by calling GoogleAnalyticsTracker.getInstance()
Then call its start() method, passing the web property ID and activity being tracked.
within Android apps/games
Step 3
Track pageviews and/or events …
within Android apps/games
Step 3
Batching Hits : to save on connection and battery overhead, you can dispatch hits manually, or at specifi time intervals by using the dispatch() method of the tracker object. It is recommended that you reduce overhead by bundling tracker dispatches with other HTTP requests made by the application :
Stop the tracker when it is no longer needed :
within Android apps/games
Wait 24 hours to see your first data coming through in Analytics … !
within Android apps/games
Step 1 : JAR file - 1’ max
Step 2 : Web property ID - 1’ max
Step 3 : code - 3’ max (6 lines min)
No excuse really not to do / try it !
In 5 minutes, you’re done !
For example …
HTC Tattoo
Nexus One
[Menu] key
Inviting users to use the [Menu] key has boosted traffic on the Belgian Apps page…
within Android apps/games
How to get started ?
Get started using Google Analytics to understand and optimize how people use your Android mobile app !
Check out the SDK and technical docs here :
http://code.google.com/intl/en/apis/analytics/docs/tracking/mobileAppsTracking.html
Have FUN