Categories
Print

Firing events to Universal Analytics using Google Tag Manager

What are Events in Google Analytics? 


Interactions that the visitor performs on the website are known as Events in Google Analytics. These interactions can be


  • * Downloading a file 
  • * Playing a video 
  • * Clicking on button 
  • * Clicking on chat functionality
  • * Submitting a form



Google Analytics Event Structure: 


Google Analytics event is structured using Category, Actions & Labels. They are used as below: 


  • Event Category: The top-level category you wish to give to a single or group of similar categories. For instance, videos, outbound links, on page buttons etc..
  • Event Action: The kind of interaction you are tracking. For instance: downloading files, playing videos etc.. 
  • Event Label: More information related to the event being tracked. For instance: name of the files that are allowed to be downloaded or name of the video
  • Event Value (Optional): The value you are assigning to the Event. For instance: monetary value to weight or time etc..



Pushing data into Google Analytics using Google Tag Manager: 


The process of firing events to Google Analytics (i.e. Universal Analytics) is a three step process.

  1. 1. Create a tag to fire event on GTM
  2. 2. Create a custom trigger that invokes the above tag
  3. 3. Use the Javascript block to fire events

#1 Create a tag to fire event on GTM: 


The users need to follow the following steps under Google Tag Manager:



Step 1: 


Create a tag in Google Tag Manager

  • Tag type: Google Analytics: Universal Analytics
  • Track Type: Event


Step 2: 


Map Category, Action, Label, Value fields with variables 

For instance: eventTracking_category, eventTracking_variable, eventTracking_label, eventTracking_value


If the Data Layer variables are not available, the user will have to create the new variables


#2 Create a trigger: 


Step 1: 
Create new trigger with “Custom Event” type 


Step 2: 
Give name to the Trigger 

For instance: “i-genie-Chatbot-Event” 


Step 3: 
Map the Trigger with above created Tag



#3: Add the Javascript block in the flow

In the chatbot builder screen, open the chatbot where you want to fire Google Analytics events: 


Step 1: 
Goto bot builder



Step 2: 
Add Javascript Action Block in the flow where user would like to push data / events into the Google Analytics


Adding the Javascript after a block fires the event once the flow passes through that block


Step 3: 


Add the following snippet in Javascript action block

dataLayer.push({'event': wotnot-chatbot-trigger,'eventTracking_action': 'click','eventTacking_category': 'Chatbot – Lead','eventTracking_label': 'Chatbot - Label', 'eventTracking_value': 'Chatbot - Value'});

User can define the values / variables in the above snippet as per the requirement

Use the event labels as defined in GTM