1. Home
  2. Integrations & Configurations
  3. How to track WebEngage Events with Google Tag Manager and Universal Analytics Tag Type?

How to track WebEngage Events with Google Tag Manager and Universal Analytics Tag Type?

In order to track WebEngage Events with Google Tag Manager (GTM) with Universal or Classic Analytics Tag Type, you would have to implement the solution in two steps:

Step 1: Google Tag Manager (GTM) Configuration for WebEngage Event Tracking

  1. First Create a new Tag inside your GTM dashboard.
  2. Give an appropriate title (e.g. ‘GA-Events’) and then select tag type as ‘Google Analytics > Universal/Classic Analytics‘.
  3. Copy the tracking-id from your Google Analytics account and then paste it in the Tracking ID
    field of your GTM.
  4. Set ‘Track Type’ of your Tag to ‘Event’. Since we are using dataLayer API of GTM, you will need to add appropriate macros for all the parameters. Refer the below image for the same.

    WebEngage Events GTM Tag
    WebEngage Events GTM Tag
  5. For Non-Interaction Hit you might have to add a dataLayer Macro. See the image below.

    Create nonInteraction dataLayer macro
    Create nonInteraction dataLayer macro
  6. Now, go to the ‘Firing Rules‘ section and click on add to insert rule.
  7. An edit rule window would open up. Give a¬†suitable name for your rule and in the ‘Conditions‘ section add ‘event‘ condition with operation set to ‘equals‘ and values ‘WebEngage-Survey‘. Save to add the rule.
  8. Then repeat step 5 and 6 for events ‘WebEngage-Notification‘ and ‘WebEngage-Feedback‘. Refer the following three images.
    Feedback Events Firing rule
    Feedback Events Firing rule
    Survey Events Firing rule
    Survey Events Firing rule

    Notification Events Firing rule
    Notification Events Firing rule

Step 2: WebEngage Widget Integration Code Changes

  1. Add the line _weq[‘webengage.ga.gtm’] = true; in the WebEngage widget integration code. This would let WebEngage Widget know that you are using Universal GA with GTM.
  2. Optionally, if you want to track for a specific GA tracking-id when you have both classic and universal GA, add the line _weq[‘webengage.ga.trackerId’] = ‘UA-XX-XXXX’; in the widget integration code.
  3. If you are using custom value for the GoogleAnalyticsObject instead of default value (viz. ‘ga’) then add the line _weq[‘GA.universalAnalyticsFunction’] = ‘myGA’; in the widget integration code.

 

Was this article helpful?