How To Implement Google Tag Manager V5 For Your Android Application

If you are looking for a free resolution for tag management, try the Google Tag Manager v5, as the interface allows developers to change its configuration values like measurement tags and pixels in their mobile applications.

Marketers find it extremely useful today. Earlier, everything was controlled by the webmasters, making it completely technical as it involved handling log files. The Tag Manager makes the development of mobile app developer devices dynamic and easy without having to rebuild application binaries to the app marketplace.

HOW TO IMPLEMENT GOOGLE TAG MANAGER V5 FOR YOUR ANDROID APPLICATION

Currently, Tag Manager supports tags for products like Firebase Analytics, Google Analytics, DoubleClick, AdWords, Adjust, AppsFlyer, Apsalar, Kochava, and Tune. You can download APKs for free on your Android device.

Set with Firebase SDK for applications, GTM v5 adds unique supplementary features to the arena of Google Analytics. Earlier a separate entity, Firebase was purchased by Google in 2014. Firebase was then pulled out separately for mobile app development with the features of Analytics added to it.

Firebase includes tools for app development such as database storage, cloud messaging, hosting, etc. Such tools can aid in growing your app’s audience, using app indexing and push notifications.

The Firebase Analytics weaves the different features of the entire product as one. Developers can log significant events and decide later which pixels or tracking tags should be fired.

To make its maximum utilization, you may need to understand the procedure of implementing GTM for your Android Apps with a few simple steps.

Before you get started, ensure the following prerequisites:

  • First, install the Firebase SDK
  • Then in the Firebase console, add your app to the Firebase project
  • Add Firebase Analytics to your device app by downloading the google-services.json file
  • Subsequently, create a Google Tag Manager account
  • Then configure a Google Tag Manager container

Installing Google Services Json

(Source)

  1. Add Google Tag Manager In Your Android Application:
    • Firstly, in your module Gradle file (usually app/build.gradle), add the following dependency on the Tag Manager library: compile ‘com.google.android.gms:play-services-tagmanager:11.0.4.’
    • Secondly, sign into your GTM account
    • Select a mobile container
    • Click on to Versions in the top navigation bar
    • Then, click Actions>Download on the selected container version
    • Create the “app/main/assets/containers” folder in case it doesn’t exist and copy the download container to the folder

  2. Log Events And Variables:
  3. The Google Tag Manager uses Firebase Analytics’ events, user properties, and parameters to build tags that you have configured in the GTM web interface. The Firebase Analytics implementation acts as your data layer.

    You can go through the Firebase Analytics Developer Documentation for understanding all the instructions for logging events and setting the user properties.

    Once you’ve done this, it’s time to configure variables in the Tag Manager. In order to capture the value of the Firebase user properties and event parameters for use in GTM, you can configure variables in the Tag Manager interface. For instance, if you are logging the following custom event in your application:

    Bundleparams=newBundle();
    params.putString(“image_name”, name);
    params.putString(“full_text”, text);
    mFirebaseAnalytics.logEvent(“share_image”,params);

    You could then configure new Event Parameter variables in GTM to capture the image_name and full_text parameter values. So, use it as follows:

    • Variable Name: Image Name
    • Variable Type: Event Parameter
    • Event Parameter Key Name: image_name
    • &

    • Variable Name: Full Text
    • Variable Type: Event Parameter
    • Event Parameter Key Name: full_text

    Likewise, if you are setting the following user property in your application: mFirebaseAnalytics.setUserProperty (“favourite_food,” mFavouriteFood); you could then configure a new Firebase User Property variable in GTM to capture the favourite_food value:

    • Variable Name: Favourite Food
    • Variable Type: Firebase User Property
    • Event Parameter Key Name: favourite_food

    Now, let’s see how you could modify and block Firebase Analytics events. Modifying events can help you without app updates. You can add and remove or alter values of the event parameters or adjust the event names.

    Events which are not blocked will be logged in Firebase Analytics. In some cases, Firebase Analytics automatically logs a few events and user properties.

    There will be no requirement of adding any code to enable them. All these automatically collected properties and events though cannot be blocked can be used in GTM.

  4. Use Fire Tags:
  5. Let’s understand that Firebase event name variables, event parameter variables, and other variables are used to set up Triggers. Each time you log a Firebase event, Trigger conditions are evaluated.

    Firebase Analytics events automatically fire by default. You can add a Firebase Analytics tag in Tag Manager in order to block events from being sent to Firebase Analytics.

  6. Finally, Preview, Debug, And Publish Your Container:
  7. It’s always wise to preview the version of your container before publishing it so as to ensure that it works as intended.

    Google Tag Manager allows the ability to preview versions of your container by generating QR codes and links in the web interface and by using them to open your application. It also allows you to permit a verbose logging mode so that any unexpected action can be debugged.

How To Preview Container?

Before previewing a container, you may have to generate a URL in the GTM web interface by selecting the container version that you would like to preview and correspondingly choose Preview. You can save this preview URL for the later stages.

Share Preview Example

(Source)

How To Debug Container?

You can enable verbose logging in order to troubleshoot your container implementation like the following: “$ adb shell setproplog.tag.GoogleTagManager VERBOSE”

Publish Container:

Once you have reviewed and verified your container as working, it’s time to publish it.After you have published it, you will find tag configurations available to the mobile app users. When user devices are online, they will receive the updated configurations within a day itself.

With the above simple steps, your Google Tag Manager v5 can easily be configured with your Android app.

Leave a Reply

Your email address will not be published. Required fields are marked *