We are here to help

How to setup Google Analytics (GA) event tracking?

 

What is Google Analytics event tracking?


Events are user interactions with content that can be tracked independently from a web page or a screen load. Downloads, mobile ad clicks, gadgets, Flash elements, AJAX embedded elements, and video plays are all examples of actions you might want to track as Events.

Read more about events from Google Analytics site.

 

Setup GA event tracking

In this article, we are going to cover login/registration and purchase flow for event tracking. This flow contains events like:

  • registrationComplete - Fired on successful registration
  • alreadyRegistered - Fired on successful login
  • selectedMethodView - Fired when the user opened select method view
  • paymentInfoView - Fired when the user opened payment view with CC information
  • paymentInfoSubmit - Fired when the user sent CC information
  • purchaseComplete - Fired on complete purchase

The whole list of possible events is described in "What is Google Tag Manager" article. 


Preparation

Create a GTM account and link it with your publisher account. Check the section "How to add GTM scripts to Live/VOD/login/checkout pages" which describes the whole process. You also need a Google Analytics accounts, which is going to receive events fired by us during the event tracking described by an article.

 

Setup your first trigger with GA Tag (registrationComplete)

In the "What is Google Tag Manager" article you can find an example of creation triggers and tags, but here in that article we are going to cover a certain path described above. Let's start with our first event "registrationComplete":

1. Open GTM admin panel and then open the "Triggers" section.


Screen_Shot_2019-03-11_at_2.04.19_PM.png

 

2. Click "New" button


Screen_Shot_2019-03-11_at_2.10.01_PM.png

 

3. Click on "Trigger Configuration" area.

4. Choose "Custom Event"


Screen_Shot_2019-03-11_at_2.14.05_PM.png

 

5. Set name of your event (used inside of GTM) and event name "registrationComplete" which is passed from the Cleeng platform.


Screen_Shot_2019-03-11_at_2.43.31_PM.png

 

6. Click Save.

7. Right now you should see a new trigger in the list.


Screen_Shot_2019-03-11_at_2.51.02_PM.png

 

8. Let's create a new tag. To do that first lets go to the "Tags" page (left menu)


Screen_Shot_2019-03-11_at_3.05.27_PM.png

 

9. Set name of your tag and click the "Tag Configuration" area to start the creation process.

10. Choose "Google Analytics - Universal Analytics"


Screen_Shot_2019-03-11_at_3.06.23_PM.png

 

11. Set the track type to "Event" and then set the Category and Action name required for Event Tracking. At the bottom of the form please check "Enable overriding settings in this tag" and pass there with your Google Analytics ID. When everything is filled, click "Save".


Screen_Shot_2019-03-11_at_3.07.17_PM.png

 

12. You final Tag Configuration should look like this.

Screen_Shot_2019-03-11_at_3.07.30_PM.png

 

12. Click on the Triggering area and choose the previously created trigger "Registration Complete - Trigger". Then save it.


Screen_Shot_2019-03-11_at_3.07.43_PM.png

 

Your first Trigger and Tag is created. For other events (alreadyRegistered, selectedMethodView, paymentInfoView, paymentInfoSubmit, purchaseComplete) you will need to repeat the process for each of them.

 

Testing configuration

To test your configuration you should use "Preview mode". Google Tag Manager’s preview mode allows you to browse a site on which your container code is implemented as if the current container draft was deployed, so that you can test a container configuration before it is published. Sites with preview mode enabled will display a debug pane in the browser below the website content so that you can inspect which tags fired and in which order.

 

1. Enabling "Preview mode" is possible from each site of GTM by clicking the "Preview Mode" button in top right corner.

 

Screen_Shot_2019-03-11_at_3.22.45_PM.png

 

2. To reflect each change in you GTM configuration you should click the "Refresh" button.


Screen_Shot_2019-03-11_at_3.22.59_PM.png

 

3. Right now in Cleeng Login/Checkout process you should see GTM "Preview Mode"


Screen_Shot_2019-03-11_at_3.28.46_PM.png

 

4. If your event is properly configured you should see "Complete Registration" Tag fired after registration


Screen_Shot_2019-03-11_at_3.32.06_PM.png

 

5. In you Google Analytics dashboard you should see an event:


Screen_Shot_2019-03-11_at_3.39.06_PM.png

 

How to use “viewName” to trigger events?

Previously, in order to trigger events we have used the “event” parameter from dataLayer code. However, there are some events worth tracking (like how many times users opened Checkout) which use a different parameter - “viewName”.

 

vievName.png

 

This parameter is not by default defined in GTM, therefore, before you can add tags and triggers, you need to configure it first.

 

Adding a new variable in GTM

In order to trigger events based on “viewName” parameter, you need to set up it as Variable in GTM.

1. Go to “Variables” in your GTM workbench


1.png

 

2. Click “New” in “User-Defined Variables” area


2.png

 

3. Set a name for this variable (for example “viewName Variable”) and click inside Variable Configuration field


3.png

 

4. From the list on the right hand side, select “Data Layer Variable”
4.png

 

5. Set “viewName” as “Data Layer Variable Name” and press “Save” in the top right corner


5.png

Trigger event based on “viewName” variable

Now that you have the “viewName” variable configured, you can use it to create triggers and tags. In this example, we will add an event that will be triggered when a user opens checkout. First you need to create a trigger. The basics will be the same as before, however, there are two things which are different:

 

1. Select “Page View” as “Trigger Type”

 

1.png

 

2. Select “Some Page Views” as the option defining when the trigger should fire and add. Define the details of the specific event which will work with this trigger. In this case, the value of the viewName variable must equal to “viewCheckout” (since this is the value of the viewName parameter when Checkout is displayed).

 

 2.png

 

3. Once you have the trigger, you can proceed with creating a tag. The process is exactly the same as before, just make sure to select the trigger you have just created.

 

 

Was this article helpful?
0 out of 0 found this helpful