Tracking Mobile Apps in Google Analytics

Tracking Mobile Apps in Google Analytics

It’s no secret that mobile apps have become a critical part of the digital experience of many businesses.Tracking Mobile Apps

From banking, to shopping, to social media and everything in between, a large and increasing proportion of interactions with customers is occurring via mobile apps.

Thus, it is becoming increasingly important for businesses to measure, analyze, and gain insights from all that mobile activity.

Tracking mobile apps however, is not as straightforward as tracking a website. You cannot just drop in a standard code snippet and start collecting data. Even organizations with complex web analytics implementations will find that mobile app analytics is an entirely different animal. And if analytics is not considered and planned for early in the app development process, it can later be difficult or even impossible to capture the data you need to make informed business decisions.

Since mobile app platforms and development frameworks vary, there is no one-size-fits-all solution for implementing analytics tracking:

  • Which platforms will the app support? iOS, Android, BlackBerry, Windows?
  • Will the app be natively-coded for each platform or compiled with a JavaScript framework?

Before you make these types of decisions, analytics should be part of the discussion.

Here’s what you need to know about tracking a mobile app in Google Analytics:

Mobile App vs. Web Tracking

On the web, inserting your analytics script on every page of your site automatically tracks a default interaction (i.e. a pageview) and captures standard attributes such as the URL, page title, and referral source.

In contrast, a mobile app does not possess this automatic level of detail and granularity. Even though an app may have multiple screens, each one must be manually named and sent to GA. You can think of a mobile app as being like a single-page website, where all screen views and other interactions happen on a single page.

There are several methods for sending data to GA from a mobile app, but your choice will be limited by the platform and development environment being used to build the app.

Let’s take a look at each option and its pros and cons:

1. Google Tag Manager SDK

Implementing GTM in your mobile app comes with many of the same benefits as GTM on a website. You can manage all your tags, triggers, and variables through the GTM web interface, pass information via the data layer, and dynamically deploy updates to the container. Because of this flexibility, GTM should be the preferred method of implementing GA tracking in your app. However, it’s not universally supported at this point.

Pros Cons
  • More efficient and flexible implementation
    • Manage tagging through GTM interface
    • Set and send information via the data layer
    • Publish tracking updates dynamically via GTM without a new app release
  • More precise and reliable data
    • SDK dispatches hits in batches, improving battery life and reducing data loss due to lost network connectivity
  • Currently only supports natively-coded iOS and Android apps

2. Google Analytics SDK

The Google Analytics SDK is the standard version of GA for mobile apps. However, if you are building a native iOS or Android app, we recommend implementing your analytics tracking through GTM. This way, you will get all the features of the GA SDK along with the benefits of GTM.

Pros Cons
  • More precise and reliable data
    • SDK dispatches hits in batches, improving battery life and avoiding data loss due to lost network connectivity
  • Only supports iOS and Android apps
    • Apps built with Cordova may be able to use the SDK via a plugin
  • Less flexible tagging implementation
    • Updates to tracking require a new app release

3. Measurement Protocol

If you are not building an iOS or Android app, you will be out of luck when it comes to using the SDKs for GA or GTM. But don’t let that prevent you from making your app available on Windows, BlackBerry, or another platform. You can still collect data via GA’s Measurement Protocol. It may be more complex and less flexible, but it’s better than having no tracking at all.

Pros Cons
  • Can be used on platforms other than iOS and Android
  • Less precise and less reliable data
    • Does not automatically dispatch hits in batches, potentially losing data due to lost network connectivity
  • Less flexible tagging implementation
    • Updates to tracking require a new app release

 

4. JavaScript GATC

Many apps today are built with JavaScript-based development frameworks, such as Cordova, PhoneGap, or Ionic. These frameworks allow developers to turn HTML, CSS, and JavaScript code into mobile apps for iOS, Android, and other platforms.

If you are considering using such a framework for your mobile app, you should know that the SDKs for GA and GTM will not be supported. Instead, you will need to use either the Measurement Protocol or the standard JavaScript GA tracking code (in this case, you will need to store the analytics.js script locally within your app).

Pros Cons
  • Can be used on apps built with Cordova, PhoneGap, Ionic, or other JavaScript-based frameworks
  • Less precise and less reliable data
    • Does not automatically dispatch hits in batches, potentially losing data due to lost network connectivity
  • Less flexible tagging implementation
    • Updates to tracking require a new app release

Have you had any challenges tracking mobile apps? Let us know!

By |2018-07-26T10:12:13-04:00October 15th, 2015|9 Comments

9 Comments

  1. Chandra March 16, 2017 at 1:44 pm - Reply

    Hi,
    Thank you for sharing the very basics in simple language.

    Could you please confirm the process of installing GTM on hybrid app:

    1) Install GTM SDK. There is no need of GA SDK, since GTM SDK has all the features of GA SDK
    2) Implement analytics through GTM
    3) Pass screen names through datalayer and send to GA
    4) Set events such as click on button or custom events to pass static or dynamic values etc. through data layer.
    5) Is there a way to track e.g. button click directly as done for web by specifying element-id etc. directly through GTM?
    6) Once tagging is done. Data will start flowing only when updated app is installed by the users.

    • Marc Soares March 28, 2017 at 4:49 pm - Reply

      Hi Chandra,

      Assuming that your app supports GTM, then the process you have described makes sense.

      RE: #5, there aren’t any auto-click-tracking features available. All interactions will need to be pushed into the data layer from the app.

      Hope that helps!

      Marc

  2. Sunayana Goyale April 21, 2017 at 5:13 am - Reply

    Hi Marc,

    Can you please guide me with the process for implementing GTM with Firebase SDKs for a hybrid mobile app? Or please suggest if there is any cordova plugin that serves the purpose.

    Thanks,
    Sunayana

    • Marc Soares April 25, 2017 at 3:26 pm - Reply

      Hi Sunayana,

      You can review the official GTM + Firebase documentation here: https://developers.google.com/tag-manager/ios/v5/

      There is also a Cordova plugin for Tag Manager: https://github.com/kraihn/cordova-plugin-tag-manager

      Take a look at the above resources and let us know if you require further guidance for your particular situation.

      Marc

      • Sunayana Goyale April 26, 2017 at 2:29 am - Reply

        Many thanks for your response, Marc.

        Well, I have already gone through the first link you have posted, it has native activity associated with it. I can’t handle it since mine is Hybrid mobile app.

        Also, I had a look at the Cordova Plugin. It is mentioned in that link – When being used in combination with AngularJS, it is recommended to use “https://luisfarzati.github.io/angulartics/” with the Cordova GTM plugin (angulartics-gtm-cordova).

        Please recommend which one to be used now – cordova-plugin-tag-manager or angulartics-gtm-cordova

        I have yet an another query, though it is not relevant to the current subject. I am trying to implement User ID concept through GTM. I have a requirement to send the encrypted value to the GTM container, how do i get to see the decrypted values under User ID column in GA reports?
        Any thoughts on this, please. Much appreciated!!

        Thanks a lot in advance for your help and guidance. I shall definitely come back to you if i come across any problems while i work on it.

        Cheers,
        Sunayana

        • Marc Soares April 26, 2017 at 9:56 am - Reply

          For an AngularJS app, I think you would need to use Angulartics with the plugin angulartics-gtm-cordova. I haven’t had experience with this particular method of implementation, so unfortunately I can’t advise you further.

          Regarding User-ID tracking, if you send an encrypted value to GA, there is no way for GA to decrypt it. You would need to send decrypted values to GA if you want to see these in your GA reports. Please note that the userId field in GA does not show up as a dimension in any reports. So, if you wish to view User-ID values in GA, you would need to also store the IDs in a custom dimension.

          For more information on User-ID tracking, please see our blog post here: https://www.clickinsight.ca/about/blog/implement-user-id-tracking

          Marc

          • Sunayana April 27, 2017 at 2:00 am - Reply

            Wonderful explanation, Marc! Really appreciate you for taking out time and advising me accurately. I have gone through your article and landed up here for your assistance, again. Sorry for that.

            Here is the case, Marc: I’ve set up GA through GTM for a website and it’s a single page application. So, I have only GTM code on the source code of my website, but not GA code. With the help of your article, I chose to go with dataLayer approach for implementing UserID. Unfortunately, User IDs are not getting reflected in GA reports.

            Firstly, how do I add a piece of GA tracking code, when I have never included GA code on my website?
            ga(‘set’, ‘userId’, {{USER_ID}});

            Secondly, where should I place this code or how should i handle this?
            var dimensionValue = ‘SOME_DIMENSION_VALUE’;
            ga(‘set’, ‘dimension1’, dimensionValue);

            I have followed your article and executed all the steps accordingly in GA and GTM. But, I am not able to find User IDs in GA. Not sure where I am going wrong!
            Any help on this please?

            • Marc Soares April 27, 2017 at 10:11 am

              Hi Sunayana,

              You should first ensure that you have completed all the required steps outlined in the User-ID blog post (https://www.clickinsight.ca/about/blog/implement-user-id-tracking). In GA, you should have created a User-ID view and a custom dimension. For GTM setup, you should follow the “Google Tag Manager Configuration” section of the post.

              When you use the data layer method with GTM, you do not have to add GA tracking code directly to the page. You can set the userId field and the custom dimension in your GA tag in GTM.

              If you are still unable to get this working as desired, there may be something particular to your implementation that is causing an issue. Troubleshooting specific implementation issues is difficult to do in the comments. If you would like further assistance, we would be happy to set up a consulting appointment. Please send us an email at contact@clickinsight.ca if you would like to proceed.

              Thanks,
              Marc

  3. Sunayana April 28, 2017 at 3:11 am - Reply

    Thanks, Marc. I will do that.

Leave A Comment