If you want to use GTM in order to send events to FB analytics, you'll have to select "function call" when creating your tag in GTM. At this time, you'll have to populate the key-value pairs that you want to be in the payload your app will receive. You'll also have to reference a class which will handle this tag.
This class will implement from com.google.android.gms.tagmanager.CustomTagProvider.
Here is how a simple tag looks like in our GTM interface :
I helped to develop a connector called Cargo for my company, which helps to collect analytics through different platforms on mobile apps. Do not hesitate to take a look at it, or even to adopt it, and to pull some changes if you want to ! :)
- Here is our class Tags which handles the custom function calls set in GTM.
- Then we route the call to the selected handler/connector, depending on a parameter in the payload given by the container. This method does the job.
- Last, but not least, we route the call to the correct method of the selected handler/connector, which receives the payload with all the parameters you set in your GTM interface.
I hope this helps !