5 Considerations for Implementing Google Tag Manager on Mobile Apps

/

We’ve helped a number of companies implement the Google Tag Manager SDK on both Android and iOS apps. It’s a really powerful addition to your digital analytics arsenal for several reasons, and one that we generally recommend companies pursue when doing new Google Analytics implementations on their apps. This post, however, isn’t about those benefits.

There are a few topics that deserve discussion before pursuing a GTM SDK mobile app project. Being aware of these topics, can help smooth some of the possible problems or complications that can arise from an implementation.

It’s More Complicated

scottpilgrim-complicated

One key thing to understand at the beginning is that GTM SDK implementation in apps, by default, is more intensive than a GA implementation.

The idea is that you’re adding an entire additional layer of event communication so every tap, swipe, and interaction is an event on the datalayer for GTM with the app. That way moving forward, we can modify our tracking however we like, without having to do an additional app update through the Apple or Google stores. You don’t HAVE to track everything on the app, but the less you implement initially, the less you can react to in the future.

It should be understood that the initial implementation will take a little more developer time than just a normal Android or iOS SDK implementation for GA, but it comes with additional benefits if you do it right.

IDFA Isn’t Automatic

tumblr_m6syzfDkok1r2igbqo1_r1_500

Second, it’s important to understand how IDFA (identifier for advertisers) works with both Apple and Google stores. If you care about the referral information on your Apps, simply using the GTM SDK isn’t enough. You still need to properly set up your account, and use the correct tagging of all your marketing initiatives driving users to the appropriate stores. If your marketing links aren’t tagged, and you don’t set things up correctly, you won’t get that referral information.

It’s not hard, but if you can’t get your marketing department to use the proper tags, you simply won’t have the source information.

Debugging is a Pain

giphy

A third, and big one, is that debugging the app with GTM SDK is a pain.

There is no great way to debug the app at present, and in my opinion, the best that you can do while developing it is to have a network sniffer of some sort and watch the hits leave your app from your development environment. Once the app is built, the only real, and effective, way to debug is to have a “script” of user actions, and then test by following said script, and waiting for the data.

Real Time reports inside of Google Analytics don’t work well with apps because of the way the data is sent. Apps use a dispatch process and only sends the data at intervals to Google (covered below.)

Be prepared to debug things differently than you do with your web implementations.

Dispatching Works Differently

9488_23ac

Another misunderstanding centers around when the data does get dispatched to Google Analytics.

The app will store the data and send it out in bursts (to save battery, etc.), but if the user turns the app off or minimizes it, the data may sit there. If the user doesn’t use the app again prior to midnight on the following day, the data will be rejected. This means that it’s important to understand for mobile app tracking that it can be a bit less accurate than web tracking which can send every hit as it happens.

If you are looking for 100% accuracy on app data tracking, you’re barking up the wrong tree. Getting that 100% accuracy would come at a huge cost on the user’s battery, and would make your mobile app tracker a real resource hog. Dispatch helps make the GTM SDK and Google Analytics friendly to apps and their users. It doesn’t mean the data won’t be accurate for what is tracked, and should be considered in the aggregate.

This seems to be a complicated matter to explain to the higher-ups, who insist on 100% accuracy at the hit level. They just need to understand going in that they’re not going to get that from anyone and the priority should be creating an app that works well, and that users will keep on their phone.

Measurement Strategy is of Paramount Importance

749a249f91da57ab773a3996243b2eb7

Lastly, and most importantly, you need to understand that you will require a strong measurement strategy and implementation guide, before any development is done.

When you distribute your app it needs the default container from Google Tag Manager, already contained within it as a binary. This way there are tags for the user’s first use of the app, and you can track them immediately. If there is nothing in the GTM binary, then the user’s first visit will essentially be lost, and have no tracking.

Eventually the app will update the container, and will do so on a regular basis, but when the user first loads the app, it won’t have had time to do this important step. So the best process is to write up a very specific measurement strategy, with very strict naming conventions, and then build the tags and GTM setup in the container, delivering the binary container file to the developers before the app is actually built.

This means that if the developers don’t follow the strict naming guidelines, then some tags and tracking won’t work, and while you can change things later on in GTM, the initial visits of users for the app could have their data affected.

Be very specific about what you want to track, and how you want every event and data value to be named.

Conclusion

As I said initially, there are tons of benefits to using the GTM SDK in your mobile app, but you need to be aware of these common pitfalls, in order to head off problems before they occur.

1) Have a very in-depth measurement strategy and implementation plan prior to development.

2) Understand that the development of the GTM SDK in mobile might take a little longer than the GA SDK depending on your plan.

3) Prepare for the debugging process to be a little awkward.

4) Educate your marketers to properly tag all their campaigns so you get your correct referral information.

5) Be comfortable with not necessarily getting every single piece of data because of the dispatch process and the realities of mobile devices.

As long as you understand all that, and prepare for it, you’ll be ready for the additional power and insight that a proper implementation using the GTM SDK will bring. It’s totally worth it.

tumblr_inline_nr2lljYOL81s6lw3t_500

Get tracking!

Sayf is a former LunaMetrician and contributor to our blog.

  • Jaap Olsthoorn

    Nice article Sayf, we solved the dispatch problem by doing a manual dispatch upon app minimize/close (works on both android and iOS). That way, your data becomes lots better. We also manually dispatch after every e-commerce transaction, just to make sure we have those essential bits of info.

    No GTM for us yet though, the debugging paragraph also makes me really hesitant to try it. As a former software tester, if there’s anything I hate, it’s delayed feedback/test results.

    • Sayf Sharif

      Jaap that’s definitely something people should do (the manual dispatch on minimize/close) and I agree it should be standard. At the same time, we’ve encountered problems before with the manual dispatch working consistently. I’m still not sure that wasn’t a problem on the end of the developers we were working with at the time, but it gave me hesitation to say “this is a 100% solution”. When it works though doing manual dispatches I think is key, and instead of relying on Google to do the dispatches, really at all times control when data gets dispatched with manual dispatches.

      I didn’t really mention the logging for GTM debugging, and that’s helpful too. It’s certainly possible, but when analysts are coming from a debugging environment on a website where they can upload something and immediately see it in GA real time, etc, then it becomes troublesome.

      What would be great would be to program in a default manual dispatch on every “hit” when you’re testing/debugging. Mostly because even when you see the log or network traffic, if it’s malformed it might just ultimately get rejected by Google Analytics itself, so I like to confirm that hits are actually showing up in GA, rather than just looking at the log files.

  • Igor Silva

    I’m trying to insert GTM in my app, but my app is on Cordova / Ionic, and nothing happens :/

    Xcode shows my GA tracking code, which leads me to believe that the app is connecting to the GTM, but in my GA panel nothing appears.

    :/

Contact Us.

LunaMetrics

24 S. 18th Street, Suite 100,
Pittsburgh, PA 15203

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.