iOS and Android SDK via Google Tag Manager (Firebase SDK)

Hi everyone,

I’m a JavaScript developer currently working on tracking for new iOS and Android apps.

For Google Analytics we will add the Firebase SDKs which come with Google Tag Manager:

Google Tag Manager for apps has changed, there are no JavaScript tags anymore. Instead one can set up custom function calls:

Android: The fully qualifed path to the class to invoke. This class must implement the CustomTagProvider interface, e.g.

iOS: The name of the class to invoke. This class must implement the TAGCustomFunction protocol, e.g. MyCustomTag

Do you have any recommendations how to implement the Snowplow trackers via GTM?

Thank you,

Hi Ian,

We’ve done via GTM as well, but on legacy rather than firebase. We’re only implementing structured event tracking via GTM, all screen views, sdk initiation etc is done natively.

I presume you understand the broad function of GTM, so won’t go into that but can give you an overview of the structure we use:

  • Set up GTM string variable as the custom GTM function name (in our case, “sp_trackStructEvent”)
  • Set up triggers in GTM appropriately based on data layer events
  • Set up custom function call tags for each event (referencing the function name variable above)
  • Put in whatever key:value pairs you want to pass i.e. “setCategory”:“Foo”, “setAction”:{{Variable}}
  • Set up your custom function prototype in tag manager as a full prototype (i.e. assuming all parameters might be passed, but ignoring them if your tag config doesn’t supply them) and then call the Snowplow function from there

Just a word of caution - in order for this process to be valuable, you need to have a very complete understanding of when/how you populate the data layer and a comprehensive schema for what data is sent there, when it is emptied, what information persists across screens etc as otherwise you will get very confusing event streams coming off the app. If you’re just sending structured events to the data layer, to GTM and then back into snowplow it isn’t worth the time investment.

This link may help in general re: setting up tracking via GTM

Hope that helps and good luck