Firstly, we can say that you can send events from your app to GA directly. However, you can send events to GTM and then GTM will send those to analytics. Many reasons can be said why to use GTM over GA such as in here. But it always a Design/Need decision!
Anyhow, For Android, A draft implementation is at https://developers.google.com/tag-manager/android/v4/#getting-started
Check it, you may have some questions, you would find the answers in here I hope. So those are some of the lessons I learnt:
- Event Names and keys at Android code should match the corresponding ones at GTM.
- Configure GTM with Variables, Triggers, and Tags. as described here: https://developers.google.com/tag-manager/android/v4/ua#create-transaction-tag
- Use pushEvent rather than push. It is easier!
Anyhow, For Android, A draft implementation is at https://developers.google.com/tag-manager/android/v4/#getting-started
Check it, you may have some questions, you would find the answers in here I hope. So those are some of the lessons I learnt:
- Event Names and keys at Android code should match the corresponding ones at GTM.
dataLayer.pushEvent("openScreen", DataLayer.mapOf("screenName", screenName));- If you send Events from GTM to GA, the "value" field should be always Integer . if not, it will not be sent
public static void pushEvent(Context context, String event,String category, String label, Integer labelValue) {DataLayer dataLayer = TagManager.getInstance(context).getDataLayer();dataLayer.pushEvent(event, DataLayer.mapOf("eventCategory", category,"eventLabel", label, "eventValue", labelValue);}
- Configure GTM with Variables, Triggers, and Tags. as described here: https://developers.google.com/tag-manager/android/v4/ua#create-transaction-tag
- Use pushEvent rather than push. It is easier!