Before Firebase Analytics is available, we use the Android Gradle project setup with several tastes, a multi build type and supply a different GTM container identifier for each build option as follows:
TagManager.getInstance(context) .loadContainerPreferNonDefault(BuildConfig.GTM_CONTAINER_ID, -1); TagManager.getInstance(context).getDataLayer().pushEvent(eventName, eventData);
where Gradle will enter a different GTM_CONTAINER_ID for each build option.
How do we achieve this with Firebase Analytics + GTM? According to the docs , we need to download:
- GTM container file from the GTM control panel [1]
- google-services.json file from the Firebase console [2]
and then just start with this event:
FirebaseAnalytics.getInstance(context).logEvent(eventName, bundle);
Where do we specify the GTM container identifier to be used? Or is it automatically determined by the name of the file that we download from the GTM control panel and put in assets/containers ? If so, how do we use a different GTM configuration for each build option, as is the case with the legacy Android GTM container?
source share