I am working with a shopping app and would like to track so events occuring on my mobile application. My objective is to track the events using Firebase Analytics and Google Tag manager and push the same events to Google analytics.
My event > Firebase > Google tag manager > Google analytics
I followed the below guide to integrate Google tag manager and Firebase analytics to my application.
https://developers.google.com/tag-manager/android/v5/
I was able to log my events on Firebase console and view in debug console. I have added dependency for Tag manager in my gradle so that the events are Send to tag manager also.
Now i would like to know, how can i push those events from Google tag manager to Google analytics? Can someone provide me insights into configuring tags and triggers on Tag manger and Google analytics
My Android code for logging events is as below
public void logEventClicked(View view){
Toast.makeText(this, "Logging event", Toast.LENGTH_SHORT).show();
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "150");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.ADD_TO_CART, bundle);
}
Google Tag Manager and Google Analytics are two completely separate tools, and can live independently of one another: You can use Google Analytics on your site by itself, just as much as you can use Google Tag Manager on your site by itself.
Without Google Tag Manager, Google Analytics may be used. Without Google Analytics, Google Tag Manager may be used. To use both in conjunction, each must be configured independently. Both are implemented similarly on your website, utilizing javascript code snippets.
Go to Analytics and select the Analytics account you registered the app with. If you're unsure, look for the Analytics tracking ID in the google-services. json file you added to your project earlier. Copy that ID to the Analytics account search in the report drop-down.
Well, I got all this information from AndroidStuff Blog written by @DavidMedenjak in any case this link got expired I am posting some extract and Images from his blog....
how can i push those events from Google tag manager to Google analytics? Can someone provide me insights into configuring tags and triggers on Tag manger and Google analytics
{{Item Name}} is another variable like the Tracking ID Constant created before. It makes use of the data layer where Firebase pushes its events. In my case I decided to use Firebase like this to track my home screen:
Bundle bundle = new Bundle();
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "home");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle);
This will send a view_item event with a parameter item_name containing the screen name to Firebase. If you want to track different events and parameters you have to use those event and parameter names respectively. So to track my screens with the code shown above I’m going to use the keys view_item and item_name.
configure my tag manager account to Push firebase events to Google analytics.
Here I use Event Name which is a predefined variable to fire this tag every time a new view_item event gets pushed to the data layer.
That’s it! What you want to do now is publish your container, download it and add it to your project. If you did get something wrong, don’t worry. You can just edit and publish a new version—Tag Manager will update itself within 24 hours.
Note: Google Analytics tracking can still be configured afterwards without changing any of your code.
Hope this helps!!!
Ok. I was quite confused for the first time. I will answer to my question in a more simple way. Please refer to images from the first answer for a better idea.
Objective: Push events from mobile app to both Firebase and Google Analytics (GA)
In my question i have asked, how to copy the events from FA to GA using tagmanager.
My event > Firebase > Google tag manager > Google analytics
I am changing this as follows. Because this is how it works. Only thing is GTM and FA are connected internally so that you only need to logEvent using FA and it will be captured by GTM, just by adding the dependency in Gradle(V5+).
My event > Firebase
My event > Google tag manager > Google analytics
I will explain few basic terms in GTM to get started.
The logic is simple. We need to create a Trigger which will push a Tag to GA. To carry the data from GTM we use an Event parameter variable.
Follow the below link to learn how to log a FA event. https://firebase.google.com/docs/analytics/android/start/
Follow below link to learn how to use GTM with Firebase. https://developers.google.com/tag-manager/ios/v5/
Say, i want to log an event as below.
bundle.putString("button_click", "Login button"); mFirebaseAnalytics.logEvent("user_interactions", bundle);
Essentially we are sending 3 data items from app.
Now, to capture the above data and push to GA we create variables/Tags/Triggers as follows.
Button click variable - Create a new Variable of type Firebase > Event parameter. Set value to Custom parameter. Value as "button_click"
Button click trigger - Create a new trigger and set the trigger to fire on Event = "user_interactions"
Button click tag - Create a tag with Universal analytics(GA) as tag type. Because we are going to push this to GA. Inside the Tag configuration, choose Track type as Event, and now you can set Category/Label/Action/Value etc here. Remember that Category and Action are mandatory. Click the icon next to Action field and choose the button_click event parameter variable. This will pass the value matching key = button_click. Set this tag to fire on above trigger. Check the "Enable overriding settings" option and set you Google analytics key here.
Now save your configurations and publish the container. Download and copy the container to app and run your app.
When you log an event in app, typically event will log in your GA console in Realtime tab within one or two minutes. If you have configured it correctly, when the app is running, it will show number of active users as greater that 0. Note that you don't need to enable debug mode. But it's always good to ensure that events are logged on Firebase console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With