Google Analytics for Android and iPhone Apps/
October 27, 2011
We all know Google Analytics is great for analyzing website traffic. But in the age of the smartphone, we want to analyze traffic to our mobile apps, too. Wouldn’t it be great if we could get the same actionable insight we get on our mobile development websites for the apps we design? Well, it turns out, you can!
Google offers an SDK for Google Analytics that provides support for both iOS (iPhone) and Android. As you’d expect from Google, the Android SDK is a little more powerful, but both allow you to get a much better picture of how people are using your app, in the same way you currently do for your website. The major difference is that with Android you can track the sources of where people actually download your app, so you can tie your marketing campaigns to the usage of the app.
Let’s do a quick overview of how it works. I’ll spare you the gory technical details, but Google provides a great walkthrough, including code samples.
How You Can Integrate With Your App
Here at LunaMetrics, just like you, we’re building the next “killer” app. It’s called InstaTweetSquare.
InstaTweetSquare will allow you to apply fancy filters to your tweets when you check-in to a location (investors, feel free to comment below, we’re seeking a $50 billion valuation). But how do we decide whether our users are finding all of the great features? What if they only like applying filters, but not Tweeting? Let’s install the Google Analytics library into our Android app and see what happens.
Once the library is installed, you need to add some code on each app view (just like Google Analytics code on your website) to let GA know which account to log, and also to track that someone was there. In my case, I’ve put tracking code on each tab:
Look familiar? This works the way Virtual Page Views do, where you provide a “page name” and tell Google to track it. So each time someone clicks on one of my tabs of the app, I’ll see that as a page viewed in Google Analytics.
Ok, now we know who is viewing what tab. That’s pretty interesting, as we see that no one seems to care about the Profile tab. Using this data, perhaps we’ll remove that tab and put it in a button. But how do we know that our users are even doing anything on our tabs? Just like for websites, we can configure Events for actions we want to monitor on the page
"Clicks", // Category
"Filter Button", // Action
"clicked", // Label
77); // Value
So I’ll add an event for someone clicking the Filter button, the Tweet button, and any other events we’d like to monitor.
It looks like everyone really understands the Filter select button, but for some reason people are clicking the Check-in button twice for every view of that page. That’s something we may want to send back to the UI team.
GA for smart phones isn’t just limited to views and clicks though. For our app, we decided on a freemium SaaS model, where our users can Tweet if they are a Free user and post to Google+ if they are a Paid user, and just like with our website, we can use Custom Variables to tell which users are which to see how they are using the app and converting.
tracker.setCustomVar(1, "User Type", "Paid", 2);
Finally, the all important goal of our app is in-app purchases. And just like on the web, we can configure E-commerce for Android, so when someone buys our custom filters, it’s logged just like any other E-commerce transaction (sample code is pretty long, but Google has a great example).
All of the examples above are sent to Google almost immediately when the user is online. Something to keep in mind though: apps that can be used offline can still use GA, but the data will only be dispatched once the user is online again. This may cause some of your data to have inaccurate timestamps.
As you can see, pretty much anything you can do with Google Analytics for the web, you can do with GA for mobile. If you have a smart phone app, it’s worth thinking about using Google Analytics’ Mobile SDK to analyze user behavior.