If you’ve ever wanted to use Google Analytics for Firebase and standard Google Analytics via Google Tag Manager on an eCommerce app you’ve probably stumbled upon one major pain point…Google Analytics for Firebase and GTM (v5) doesn't support enhanced eCommerce. Until now!
Before today this meant that you had to duplicate tracking within the app by implementing the Firebase SDK and the Google Analytics SDK – which added weight and network usage to your app, something developers really don’t like.
Well, pain point no more! Google recognised the problem and as of today, the Google Analytics for Firebase SDK allows you to surface enhanced eCommerce data for Google Tag Manager to push to standard Google Analytics.
Ok, so how do I implement it?
The answer is, very easily.
I’ll run through a transaction implementation on an example Android application, however the process is very similar on iOS. Keep in mind that enhanced eCommerce allows you to also track Add to Cart, Remove from Cart, Product Impressions, Product Detail views and loads more useful data.
The first step is defining the product level data of our eCommerce transaction. In typical Java/Android fashion we do this using bundles, like so (repeat for however many items in your transaction):
Next, we need to add the items defined in the previous step to a new ArrayList and add it to a new Bundle:
Finally, we just need to log an event with the eCommerceBundle attached (you can log any type of event, it doesn’t need to be eCommerce_purchase specifically):
That’s the coding part out of the way – easy, right? The next step is to configure the relevant tag in Google Tag Manager to accept the Enhanced Ecommerce data and send it to GA along with the original event data.
In your tag that is triggered on the “eCommerce_purchase” event in GTM navigate to More Settings > eCommerce, set the dropdown to “True” and then read the data from “Firebase Event”:
That’s it. It really is that simple! If you have any questions or would like our help implementing Enhanced Ecommerce using Firebase/GTM get in touch with one of our experts here.