Google Analytics Event Tracking Tutorial

What is Google Analytics event tracking?

Google Analytics event tracking is an advanced feature that allows you to track a specific user’s interaction/activity (link clicks, downloads, form submission and video plays) with a web page element.

What is an event in Google Analytics?

The user’s interaction/activity with a web page element that you track in Google Analytics is called an ‘event’.

Following are examples of web page elements:

  • video
  • gadget
  • podcast
  • image
  • button
  • form
  • scroll bar
  • external link
  • lightbox
  • Ajax content etc.

A user can interact with a web page element via a mouse, keyboard, frame or form.

Consequently, we can have:

  • Mouse events – These are users’ interactions with a mouse.
  • Keyboard events – These are users’ interactions with a keyboard.
  • Frame events – These are users’ interactions with a frame/iframe.
  • Form events – These are users’ interactions with a form embedded on a web page.

All of these events can or can not generate pageviews when they occur.

Examples of events that can be tracked via Google Analytics event tracking:

Following are the examples of events that can be tracked via Google Analytics event tracking:

  1. Downloading a file
  2. Loading of Ajax, JavaScript or Flash content
  3. Loading of a dynamically generated webpage
  4. Loading of pop-ups, lightboxes
  5. Loading of a video on a webpage
  6. Scrolling down the page
  7. Viewing of a video
  8. Viewing video footage of certain length
  9. Clicking on a video’s play/pause/stop button
  10. Interaction with a gadget
  11. Clicking on an image or an external link
  12. Abandonment of a form field
  13. Log-ins
  14. Sharing/printing a blog post, article, video or image
  15. Clicking on a button
  16. Movement of mouse

Categories of Google Analytics Events

There are two broad categories of events:

  1. Events that generate pageviews when they occur.
  2. Events that do not generate pageviews when they occur.

#1 Events that generate pageviews when they occur.

For example, clicking on an internal link on a webpage generates a pageview.

#2 Events that do not generate pageviews when they occur.

For example, following users’ interactions do not generate a pageview when they occur:

  • Clicking on an external link
  • Loading of Ajax/Flash content
  • Downloading a file
  • Playing a video
  • Pausing a video
  • Reposition timing within a video.
  • Buffering of a video
  • Progress of a video
  • Scrolling a web page
  • Clicking on a form button
  • Interaction with a gadget
  • Clicking on an image
  • Abandonment of a form field
  • Sharing/printing a blog post, article
  • Adding items to a shopping cart.
  • Clicking on a button, etc.

When to use Google Analytics event tracking?

By default Google Analytics (GA) can not track any event that does not generate pageview when it occurs. 

You can track such events only through event tracking or virtual pageviews.

The rule of thumb is, track those types of users’ interactions, using ‘event tracking’ which either do not generate a pageview when they occur or which are not equivalent to a page being viewed.

Structure of Google Analytics events

An event in Google Analytics is made up of:

  1. Event Category
  2. Event Action
  3. Event Label
  4. Event Value

What is Event Category in Google Analytics Event Tracking?

The ‘event category’ is the name assigned to the group of similar events you want to track.

You can use any value of type ‘text’ as an event category. This is basically the element the user interacted with on the web page, for example, video.

How to see the values of Event Category in Google Analytics?

If you have already set up event tracking then you can see the values of the ‘event category’ in Google Analytics by following the below steps.

Step-1: Login to your Google Analytics account.

Step-2: Click on the ‘Behaviour’ tab available on the left-hand side.

Behaviour tab in GA

Step-3: When you click on the ‘Behaviour’ tab you will see a drop-down like the one below.

Events section

Step-4: Select ‘Top Events’ from the options.

Top Events Report

Note: Google Analytics report event category as a dimension in its reports.

values of Event Category in Google Analytics

What is Event Action in Google Analytics Event Tracking?

The ‘Event Action’ is the name assigned to the type of event you want to track for a particular webpage element.

You can use any value of type ‘text’ as an event action. This is the action taken by the user on a web page.

For example, video play, video pause, video progress, etc.

How to see the values of Event Action in Google Analytics?

If you have already set up event tracking then you can see the values of the ‘event action’ in Google Analytics by following the steps below:

Step-1: Navigate to Behavior > Events > Top Events reports of your GA reporting view.

Step-2: Click on the ‘Event Action’ primary dimension:

values of Event Action in Google Analytics

Note: Google Analytics report ‘event action’ as a dimension in its reports.

What is Event Label in Google Analytics Event Tracking?

The ‘event label’ is the name assigned to the web page element, whose users’ interaction you want to track.

You can use any value of type ‘text’ as an event label.

An Event label can be a title of a video, title tag of a web page, name of a gadget, name of the downloadable file, etc.

How to see the values of Event Label in Google Analytics?

If you have already set up event tracking then you can see the values of the ‘event label’ in Google Analytics by navigating to Behavior > Events > Top Events and then click on the ‘Event Label’ primary dimension:

values of Event Label in Google Analytics

Note: Google Analytics report event label as a dimension in its reports.

What is Event Value in Google Analytics Event Tracking?

The ‘event value’ is the numerical value assigned to the event you want to track.

You can use any value of type ‘number’ as an event value. However, you can not use any value of type ‘text’ as an event value.

For example, an event value can be any number that represents a download time, length of the video footage played, or some monetary value.

How to see the values of Event Value in Google Analytics?

If you have already set up event tracking then you can see the values of the ‘event label’ in Google Analytics by navigating to Behavior > Events > Top Events:

values of Event Value in Google Analytics

Note(1): If you want to assign a monetary value to a tracked event then use the ‘event value’.

Note(2): Google Analytics report event value as a metric in its reports.

Google Analytics Event Tracking Best Practices

Following are the best practices for Google Analytics event tracking

  1. Track those types of users’ interactions as events which either do not generate a pageview when they occur or which are not equivalent to a page being viewed.
  2. Do not omit ‘Event Action’ while setting up event tracking in Google Analytics.
  3. Specifying field values in the correct order is important when hardcoding the event tracking code.
  4. Use the correct data type for your field values while setting up event tracking.
  5. Follow naming conventions for event tracking.
  6. Use Google Tag Manager to track events.
  7. Avoid event tracking from negatively impacting your website bounce rate through non-interaction event.
  8. Avoid using duplicate ‘event action’ names across categories.
  9. Plan out your even tracking structure in advance before you set up event tracking.

Best Practice #2: Do not omit ‘Event Action’ while setting up event tracking in Google Analytics.

If you are using analytics.js library to set up event tracking then specifying ‘event category’ and ‘event action’ is mandatory. Whereas, specifying ‘event label’ and ‘event value’ is optional.

Example:

ga(‘send’,’event’,’videos’,”,’chappy’,100); // incorrect because ‘event action’ is missing.

ga(‘send’,’event’,”,’Play’,’chappy’,100); // incorrect because ‘event category’ is missing.

ga(‘send’,’event’,’videos’,’Play’,’chappy’,100); // correct

If you are using the analytics.js library then default values of eventCategory, eventAction, eventLabel and eventValue fields is ‘(not set)‘.

If you are using the global site tag (gtag.js) then specifying the ‘event category’, ‘event label’, and ‘event value’ is optional. However, specifying ‘event action’ is mandatory.

Example:

gtag(‘event’,” , {
‘event_category’ : ‘videos’,
‘event_label’ : ‘Chappy’
}); // Incorrect because ‘event action’ is missing.

gtag(‘event’, ‘Play’, {
‘event_category’ : ‘videos’,
‘event_label’ : ‘Chappy’
}); //correct

Note: If you are using the gtag.js library then the default value of the ‘event category’ is ‘engagement’ and the default value of the ‘event label’ is (not set).

Best Practice #3: Specifying field values in the correct order is important when hardcoding the event tracking code

Consider the following event tracking code:

ga(‘send’, {

‘hitType’: ‘event’,

‘eventCategory’: ‘videos’,

‘eventAction’: ‘Play’,

‘eventLabel’: ‘chappy’,

‘eventValue’: 100

});

You can also write this line of code without using any field names:

ga(‘send’,’event’,’videos’,’Play’,’chappy’,100);

Here, Google Analytics will automatically assume that:

  • event category is ‘videos’,
  • event action is ‘Play’
  • event label is ‘Chappy’
  • event value is 100

When you do not specify field names, you then need to supply field values in the following order:

Event Category > Event Action > Event Label > Event Value

Since field values are executed in the order in which they are supplied, if I changed the order, my event tracking will work differently or worse won’t work at all.

For example:

ga(‘send’,’event’,’Play’,’videos’,’chappy’,100);

Here ‘Play’ will be treated as an event category and ‘videos’ will be treated as an event action.

Another example:

ga(‘send’,’event’,’Play’,’videos’,100);

here 100 will be treated as event label instead of event value.

To avoid this issue, you can leave the ‘event label’ field empty:

ga(‘send’,’event’,’Play’,’videos’,”,100);

Best Practice #4: Use the correct data type for your field values while setting up event tracking

The eventCategory, eventAction and eventLabel fields accept a value of type text. Whereas, the eventValue field accepts a value of type integer.

So following event tracking codes are going to create tracking issues:

ga(‘send’,’event’,videos,’Play’,’chappy’,100); // incorrect because ‘event category’ accepts value of type text.

ga(‘send’,’event’,’videos’,’Play’,’chappy’,’100′); // incorrect because ‘event action’ accepts value of type integer.

Note: There is no hard and fast rule regarding what data you put into ‘event category’, ‘event action’, ‘event label’ and ‘event value’ as long as you are assigning values of type text to ‘event category’, ‘event action’ and ‘event label’ and values of type integer to ‘event value’.

Best Practice #5: Follow naming conventions for event tracking

Use descriptive names for event categories, event actions, and event labels. So that just by looking at the name, a user can understand what type of data is being collected.

Likewise, use consistent names for event categories, event actions, and event labels.

So if you are using ‘videos’ as an event category, then do not use ‘video’, ‘Videos’, ‘VIDEOS’ as an event category.

Otherwise, you will end up creating several different event categories in Google Analytics that all hold the same type of event data.

One of the best ways to use consistent names is by using only lowercase letters for event categories, event actions, and event labels.

Best Practice #6: Use Google Tag Manager to track events.

There are two methods to set up Google Analytics event tracking:

#1 Hard code the Google Analytics event tracking code on your website that tracks a specific user’s interaction (aka event) with a web page element.

#2 Use Google Tag Manager to track users’ interaction with the web page elements.

The advantage of using GTM to track events is that it is easier to use and is scalable.

So if you want to track clicks on the buttons across your website in one go without manually adding the event tracking code to each and every button, you can easily do that via Google Tag Manager.

Best Practice #7: Avoid event tracking from negatively impacting your website bounce rate through non-interaction event

The ‘nonInteraction’ event is used to designate an event as interactive or non-interactive. This field object can have a value of true or false.

The default value is false, which means by default an event is considered interactive and impacts the bounce rate calculations.

If you want to make an event non-interactive so that it doesn’t impact the bounce rate calculations then set the nonInteraction value to true.

The {‘nonInteraction’: true} is used to designate an event as non-interactive. You can also use {‘nonInteraction’: 1} to designate an event as non-interactive.

Example

If you are using the analytics.js library:

ga(‘send’,’event’,’videos’,’Play’,’chappy’,100, {‘nonInteraction’: 1});

ga(‘send’,’event’,’videos’,’Play’,’chappy’,100, {‘nonInteraction’: true});

If you are using the gtag.js library:

gtag(‘event’, ‘Play’, {
‘event_label’: ‘chappy’,
‘event_category’: ‘videos’,
‘value’: 100,
‘non_interaction’: 1
});

gtag(‘event’, ‘Play’, {
‘event_label’: ‘chappy’,
‘event_category’: ‘videos’,
‘value’: 100,
‘non_interaction’: true
});

For Google Tag Manager:

non interaction hit

Best Practice #8: Avoid using duplicate ‘event action’ names across categories

There is a disadvantage of using duplicate ‘event action’ names across categories:

ga(‘send’, ‘event’,’videos’, ‘play’,’Spiderman-2’,10);

ga(‘send’, ‘event’,’videos’, ‘play’,’Who lets the dog out’,10);

ga(‘send’, ‘event’,’videos’, ‘play’,’Alien vs predator’,10);

The disadvantage is that the unique events are incremented by unique action names.

So if a user clicks on two different videos say ‘spiderman-2’ and ‘Aliens vs predator’ which have the same action name ‘play’, then, in that case, Google Analytics will report only one unique event, even when the user clicked on two different videos.

So action names needs to be unique:

ga(‘send’, ‘event’,’videos’, ‘play-spiderman’,’Spiderman-2’,10);

ga(‘send’, ‘event’,’videos’, ‘play-dog-out’,’Who lets the dog out’,10);

ga(‘send’, ‘event’,’videos’, ‘play-aliens-predator’,’Alien vs predator’,10);

If you are using the gtag.js library then the above code can be written as:

gtag(‘event’, ‘play-spiderman’, {
‘event_category’ : ‘videos’,
‘event_label’ : ‘Spiderman-2’
});

gtag(‘event’, ‘play-dog-out’, {
‘event_category’ : ‘videos’,
‘event_label’ : ‘Who lets the dog out’
});

gtag(‘event’, ‘play-aliens-predator’, {
‘event_category’ : ‘videos’,
‘event_label’ : ‘Alien vs predator’
});

Best Practice #9: Plan out your even tracking structure in advance before you set up event tracking

Before you implement event tracking:

#1 Determine in advance, all of the web page elements (like videos, gadgets, images, external links, etc) you want to track and the type of users’ interactions (aka events) you want to track for each web page of your website.

#2 Create a hierarchy of event categories, event actions, and event labels that is scalable. So that you don’t need to frequently change the names of event categories, event actions, and event labels to hold different types of event data.

#3 Use an Excel Spreadsheet to decide the names of all your event categories, event actions, and event labels in advance. Then work with your report users, to make sure that your hierarchy is understandable:

event-naming-conventions

How to set up event tracking in Google Analytics?

In order to set up Google Analytics event tracking, follow the steps below:

Step-1: Determine in advance, all of the web page elements (like videos, gadgets, images, external links, etc) and the type of users’ interactions you want to track for each web page of your website.

Step-2: Create a hierarchy of event categories, event actions, and event labels that is scalable. So that you don’t need to frequently change the names of event categories, event actions, and event labels to hold different types of event data.

Step-3: Use an Excel Spreadsheet to decide the names of all your event categories, event actions, and event labels in advance. Then work with your report users, to make sure that your hierarchy is understandable.

Step-4: Choose one of the following methods to set up event tracking in Google Analytics:

  1. Hard code the Google Analytics event tracking code on your website that tracks a specific user’s interaction with a web page element.
  2. Use Google Tag Manager to track users’ interaction with the web page elements.

Event Tracking Setup Method #1: Hard code the Google Analytics event tracking code on your website

Let us suppose you want to track clicks on a download button (embedded on a web page on your website) in Google Analytics via event tracking.

Follow the steps below:

Step-1: Navigate to the web page (via Google Chrome web browser) which contains the button you want to track via event tracking.

Step-2: Right-click on the button and then click on ‘Inspect’ from the drop-down menu:

inspect element

Step-3: Find your button code. It is going to look something like the one below:

button code

<button id=”checklist3″ type=”button” onClick=’location.href=”http://www.mywebsite.com/Worksheets/worksheets.pdf”‘>Download</button>

Step-4: Copy the button code into your notepad.

Step-5: Create your Google Analytics Tracking Code using the following syntax:

ga(‘send’,’event’,’<INSERT YOUR EVENT CATEGORY>’,’<INSERT YOUR EVENT ACTION>’,’<INSERT YOUR EVENT LABEL’>,<INSERT YOUR EVENT VALUE>);

For example,

ga(‘send’, ‘event’, ‘guides’, ‘download-cro’, ‘cro-beginners-guide.pdf’, 10)

Here, Google Analytics will automatically assume that:

event category is ‘guides’,
event action is ‘download-cro’
event label is ‘cro-beginners-guide.pdf’
event value is 10

Step-6: Add your Google Analytics Event tracking code to your button code:

<button id=”checklist3″ type=”button” onClick=”ga(‘send’, ‘event’, ‘guides’, ‘download-cro’, ‘cro-beginners-guide.pdf’, 10);location.href=”http://www.mywebsite.com/Worksheets/worksheets.pdf”>Download</button>

Here, onClick is a mouse event handler. It executes a method/function (called ‘ga’) in response to click on the button. This event handler is used to tie the event tracking code to the button.

Note: You can also use the event tracking code builder tool to generate event tracking codes.

Step-7: Open your FTP tool and then navigate to the web page/file which contains the button you want to track via event tracking.

Step-8: Download the file, open it, and then replace the button code with your new button code (the button code with event tracking code).

Step-9: Upload the file to your web server. This will replace the old file with the new version.

Step-10: Navigate to the web page (via Google Chrome web browser) which contains the button you want to track.

Step-11: Click on the button.

Step-12: Navigate to your Google Analytics view.

Step-13: Click on ‘Real-time’ on the left-hand menu.

real time

Step-14: Click on the ‘Events’ tab under the ‘Real-time’ reports.

Realtime events

Step-15: On the right-hand side, under ‘Active users’, you will see ‘Event category’ and ‘Event action’.

Real Time events

You should now be able to see your event category and event action values being reported.

If you don’t see your event category and/or event action then it means your event tracking is not set up correctly.

Event Tracking Setup Method #2: Use Google Tag Manager to track users’ interactions (aka events) with the web page elements.

This is the recommended method to track users’ interactions with web page elements as it is easier to use and is scalable.

So if you want to track clicks on the buttons across your website in one go without manually adding the event tracking code to each and every button, you can easily do that via Google Tag Manager.

Let us suppose you want to track clicks on download buttons embedded on dozens of web pages on your website via event tracking.

Follow the steps below:

Step-1: Navigate to the web page (via Google Chrome web browser) which contains the button you want to track via event tracking.

Step-2: Right-click on the button and then click on ‘Inspect’ from the drop-down menu:

inspect element

Step-3: Find your button code. It is going to look something like the one below:

<button id=”checklist3″ type=”button” onClick=’location.href=”http://www.mywebsite.com/Worksheets/worksheets.pdf”‘>Download</button>

Step-4: Note down the ‘id’ attribute of the button. In our case, it is ‘checklist3‘.

Note: The ‘id’ value that you use should be unique. If the ‘id’ attribute is missing, then ask your developer to add it.

Step-5: Install Google Tag Manager on your website (if you have not already).

Step-6: Login to your Google Tag Manager account.

Step-7: Click on the ‘Triggers’ link and then click on the ‘New’ button to create a new trigger:

new gtm trigger

Step-8: Name the new trigger ‘Check for clicks on the download button

name the trigger

Step-9: Click on ‘Choose a trigger type to begin setup‘:

Choose a trigger type to begin setup

Step-10: Click on ‘All Elements’:

trigger type all elements 1

Step-11: Click on ‘Some Clicks’:

some clicks

Step-12: Click on ‘choose built-in variable’ from the drop-down menu:

chose built in variable

Step-13: Select ‘Click ID’:

choose built in variable2
click id

Step-14: Enter the id of your button element in the text box next to ‘equals’ and then click on the ‘Save’ button:

click id2

Step-15: Click on the ‘Tags’ link and then click on the ‘New’ button to create a new tag:

create a new tag in gtm 1

Step-16: Name your new tag ‘Send click on the button download to GA as event’:

name your new tag

Step-17: Click on ‘Choose a tag type to begin with’:

Choose a tag type to begin with

Step-18: Select ‘Google Analytics: Universal Analytics’ as a tag type:

Google Analytics Universal Analytics

Step-19: Select ‘Event’ from the ‘Track Type’ drop-down menu:

track type event

Step-20: Set ‘Category’ to ‘guides’, ‘Action’ to ‘download-cro’, ‘Label to ‘cro-beginners-guide.pdf’, ‘Value’ to 10 and ‘Non-Interaction Hit’ to ‘True’:

event tracking parameters

Step-21: Click on the checkbox ‘Enable overriding settings in this tag‘ and then enter your GA tracking ID:

Enable overriding settings in this tag

Step-22: Click on the ‘Choose a trigger to make this tag fire…’:

Choose a trigger to make this tag fire

Step-23: Find and click on the trigger ‘Check for clicks on the download button’:

choose a trigger

Step-24: Click on the ‘Save’ button to save your new tag.

save button

Step-25: Click on the ‘Preview’ button on the top right-hand side:

preview button

When you click on ‘Preview’ to enter preview mode, it opens in a new window with the Start Tag Assistant and information about the GTM container entering debug mode, as shown below.

GTM Preview Mode

Step- 26: Enter the website URL in the box provided and click on ‘Start’.

GTM Preview Mode URL Update

Step-27: Refresh the web page that contains the button you want to track. You should now be able to see the GTM debug console window at the bottom of the page:

GTM Debugger Connected

Step-28: In the GTM Preview window, you will see a screen like below that will show us that debug mode is connected. Click on ‘Continue’.

GTM Event Console

Step-29: Now, navigate to the page where you have a download tracking option and click on the button and you should be able to view the tag firing in the console as shown below.

Tags Fired in GTM console

If you don’t see your tag listed under the ‘Tag Fired’ section then it means your tag is not firing and you did something wrong while setting up your tag or trigger.

Step-30: You can also validate if the values passed in the events are as expected by clicking on the tag, where you will be able to see the summary of the tag fired.

Event details in console

Step-31: If the tag is firing then click on the ‘Submit’ button on the top right-hand side:

submit gtm

Step-32: Enter ‘Added a new tag to track clicks on ‘download’ buttons as version name and then click on the ‘Publish’ button:

version name

How to make sure that Google Analytics event tracking is working?

There are four methods through which you can make sure that event tracking is working as intended:

  1. By looking at the real-time events’ report.
  2. By using Omnibug Chrome extension.
  3. By using Google Tag Assistant.
  4. Through Google Developer Console

Method #1: By looking at the real-time events’ report.

Trigger the event you are tracking (via GA event tracking code) and then look at the real-time events report to check whether the event data (category, action, label) is being passed to Google Analytics:

real time events report

Method #2: Using Omnibug Chrome extension

Before following this step, make sure you have downloaded the Omnibug Chrome extension from the Chrome Webstore.

Trigger the event you are tracking (via GA event tracking code) and then open the Omnibug by following the control command ctrl+shift+I and click on the Omnibug tab.

Validate the event’s event action, category and label under the ‘Events’ section. 

Omnibug Chrome extension

Method #3: Using Google Tag Assistant

Trigger the event you are tracking (via GA event tracking code) and then click on the Google Tag Assistant extension and click on the property ID. You will see the events fired on the page.

Google Tag Assistant

Now, click on the events and you can see the event details in the Tag Assistant extension as below:

tag

Method #4: Through Google Developer Console

The fourth way to see the real-time firing of events is through the ‘Google developer console’.

Trigger the event you are tracking (via GA event tracking code) and then look at the Google developer console to check whether the event data (category, action, label, value) is being passed to Google Analytics:

google developers console

I prefer to use this method, as the developer console provides much more detailed information about fired events than the real-time event’s report.

The Google developer console also provides error messages in case the event does not fire. The real-time events report in GA does not provide any such information. 

So if your event is not firing and you just rely on real-time events reports, then you will have a hard time diagnosing event tracking issues. 

If you do not supply event category value while setting up event tracking (in the case of analytics.js), then the tracked event will not be counted in the ‘Total events’ metric and will not be reported in GA event reports.

The Google developer console will also show you the error message:

Missing required field ‘eventCategory’ for hit of type ‘event’:

Missing required field 'eventCategory' for hit of type 'event

Just like the event category, the event action is also a required field.

But unlike event category, if you do not supply the even action value while setting up event tracking (in case of analytics.js), then the tracked event (without event action) will still be counted in the ‘Total events’ metric.

Google developer console will show you the error message:

Missing required field ‘eventAction’ for hit of type ‘event’:

Missing required field 'eventAction' for hit of type 'event':

Understanding Events reports in Google Analytics

There are 4 event tracking reports available in Google Analytics:

  1. Overview report
  2. Top Events report
  3. Pages report
  4. Events Flow report

The events reports are available under the ‘Behavior’ menu in Google Analytics:

Events reports in Google Analytics

Events Overview report in Google Analytics

The ‘Events Overview’ report provides an overview of tracked events on your website:

Events Overview report in Google Analytics

Total events – It is the total number of users’ interactions with tracked webpage elements. For example, if a visitor clicks on the ‘play’ button of the same video 5 times, then GA reports total events as 5

Unique events – It is the total number of unique users’ interactions with tracked webpage elements in a web session.

For example, if a user clicks on the ‘play’ button of the same video 5 times, then GA reports total events as 5 but unique events (number of unique interactions that occurred in a web session) as 1.

Event Value – It is the total value of an event or set of events.

Avg. Value – It is the average value of an event or set of events.

Sessions with an event – These are those Google Analytics sessions in which at least one tracked event occurred.

Events/Session with an event – It is the average number of tracked events that occurred in a Google Analytics session.

Top Events report in Google Analytics

Through the ‘Top Events’ report, you can determine the most popular event categories, event actions and even labels:

Top Events report in Google Analytics

The popularity is measured in terms of total events.

Event Pages report in Google Analytics

Through the ‘Event Pages’ report, you can determine the pages of your website on which the maximum number of events were recorded by GA:

Event Pages report in Google Analytics

These are the pages that provide maximum user engagement.

Events Flow report in Google Analytics

Through the ‘Events Flow’ report, you can visualize the order in which visitors triggered events on your website. This report also lets you understand the events that are keeping users engaged on the website.

Events Flow report in Google Analytics

In order to interpret the events flow report accurately, it is critical that you use clear and consistent naming conventions for event categories, actions, and labels.

Configuring the Events Flow report includes:

  1. Examining Nodes and Connections
  2. Applying Default or custom Segments
  3. Comparing data of different time range
  4. Selecting dimensions
  5. Exporting the events funnel report etc.

You can learn more about this configuration here.

Event dimensions and metrics

You also need to remember, that ‘event category’, ‘event action’ and ‘event label’ are reported as dimensions in GA reports. Whereas ‘event value’ is reported as a metric in GA reports:

Event dimensions and metrics

Note: ‘event category’, ‘event action’ and ‘event label’ are ‘hit’ level dimensions. In other words, you can’t use ‘event category’, ‘event action’ and ‘event label’ as metrics in GA reports.

To understand the difference between dimensions and metrics, read the article: Complete Guide to Dimensions and Metrics in Google Analytics

How to set up events as goal conversions in Google Analytics?

You can also set events as Goals in Google Analytics and assign a monetary value to it.

Follow the steps below:

Step-1: Login to your Google Analytics account and then navigate to the main reporting view.

Step-2: Navigate to the admin section and then click on ‘Goals’ under the ‘View’ column:

goals

Step-3: Click on ‘+New Goal’ button:

new goal

Step-4: Scroll down and then select the ‘custom’ option (under ‘Goal Setup):

custom goal

Step-5: Click on the ‘continue’ button and then give your goal a name (like ‘Add to Cart’):

goal name

Step-6: Select goal type to ‘Event’ and then click on the ‘Continue’ button:

set up events as goal conversions in Google Analytics

Step-7: Enter the values for ‘event category’, ‘event action’, ‘event label’ (optional) and ‘event value’ (optional):

event conditions

Step-8: Click on the ‘Save’ button.

Event tracking configuration and collection limits

Apart from the general collection limits and quotas, there are limits per session.

The first ten event hits sent to Google Analytics are processed and immediately tracked. After this, tracking is limited to one hit per second.

Setting up Google Analytics event tracking (gtag.js)

Following is an example of an event hit in Google analytics (gtag.js):

gtag(‘event’, <action>, {
‘event_category’: <category>,
‘event_label’: <label>,
‘value’: <value>
});

Note: If you are using the global site tag (gtag.js) then specifying the ‘event category’, ‘event label’ and ‘event value’ is optional. However, specifying ‘event action’ is mandatory. The default value of the ‘event category’ is ‘engagement’ and the default value of the ‘event label’ is (not set).

The following example code fires a Google Analytics Event with an action of ‘Play”, a category of ‘videos’, and a label of ‘Chappy’:

gtag(‘event’, ‘Play’, {
‘event_category’ : ‘videos’,
‘event_label’ : ‘Chappy’
});

Default Google Analytics Events (gtag.js)

The default Google Analytics Events are the events that are pre-set with default categories and labels.

Google recommends using the default events in order to maintain consistent reporting and interoperability with future functionality.

The following table lists the default Google Analytics Events, their default categories, and default label types (if available):

Setting up Google Analytics event tracking (gtag.js)
Setting up Google Analytics event tracking (gtag.js)

For event names not listed in this table (e.g. arbitrary event names that you create), the default category is ‘engagement’ and the default label is ‘not set’.

For example, the following code fires a Google Analytics Event with an action of ‘Play’, a default category of ‘engagement, and a default label of ‘(not set)’:

gtag(‘event’, ‘Play’);

Setting up Google Analytics event tracking (analytics.js)

In order to set up event tracking in GA, you need to send an event hit whenever the users’ interaction/activity you want to track, occurs.

Following is the syntax for sending an event hit in Universal Analytics (analytics.js)

ga(‘send’, {

‘hitType’: ‘event’,

‘eventCategory’: [category],

‘eventAction’: [Action],

‘eventLabel’: [Label],

‘eventValue’: [Value],

‘nonInteraction’: true

});

Here, eventCategory, eventAction, eventLabel and eventValue are the fields used for sending event hit and ‘nonInteraction’ is a field object.

If you are not sure of the difference between a field and field object in ga() command queue function, then read this article: Introduction to Google Analytics Commands

Note: Specifying ‘event category’ and ‘event action’ is mandatory. Whereas, specifying ‘event label’, ‘event value’ and ‘nonInteraction’ is optional.

Following is an example of an event hit in universal analytics (analytics.js):

ga(‘send’, {

‘hitType’: ‘event’,

‘eventCategory’: ‘videos’,

‘eventAction’: ‘Play’,

‘eventLabel’: ‘chappy’,

‘eventValue’: 100,

‘nonInteraction’: true

});

You can also write this line of code without using any field names.

For example:

ga(‘send’,’event’,’videos’,’Play’,’chappy’,100,{‘nonInteraction’: true});

Here, Google Analytics will automatically assume that:

  • event category is ‘videos’,
  • event action is ‘Play’
  • event label is ‘Chappy’
  • event value is 100

When you do not specify field names, you then need to supply field values in a particular order.

In case of event tracking, you need to specify field values in the following order:

Event Category > Event Action > Event Label > Event Value

Since field values are executed in the order in which they are supplied, if I changed the order, my event tracking will work differently or worse won’t work at all.

For example:

ga(‘send’,’event’,’Play’,’videos’,’chappy’,100);

Here ‘Play’ will be treated as an event category and ‘videos’ will be treated as an event action.

Another example:

ga(‘send’,’event’,’Play’,’videos’,100);

here 100 will be treated as event label instead of event value. To avoid this issue, you can leave the ‘event label’ field empty:

ga(‘send’,’event’,’Play’,’videos’,”,100);

Another example,

ga(‘send’,’event’,’Play’,’videos’,”,100ex);

here event value is of type text. Since event value accepts a value of type integer, the code above will create tracking issues.

You can bypass all of these order rules by using field names:

ga(‘send’, {

‘hitType’: ‘event’,

‘eventCategory’: ‘videos’,

‘eventAction’: ‘Play’,

‘eventValue’: 100

});

I prefer using field names because it makes the code easy to understand. Remember:

  1. The eventCategory, eventAction and eventLabel fields accept a value of type text.
  2. The eventValue field accepts a value of type integer.
  3. The default values of eventCategory, eventActioneventLabel and eventValue fields is ‘(not set)’.

How to tie events to web page elements via event handlers?

In order to track users’ interactions with web page elements, you need to tie events to the page elements.

You can do that by using, what is called ‘event handler‘ (or ‘event listener). 

Since a user can interact with a web page element via mouse, keyboard, frame or form, we can have four categories of event handlers:

  1. Mouse event handlers
  2. Keyboard event handlers
  3. Frame event handlers
  4. Form event handlers

Mouse event handlers in Google Analytics Event Tracking

The most common mouse event handler is onClick. It executes a method/function in response to click on a web page element like a button or link.

This event handler is often used to tie the event tracking code to a button/link.

For example:

<button onClick=”ga(‘send’, ‘event’, ‘guides’, ‘download-cro’, ‘cro-beginners-guide.pdf’, 10);“>Download CRO Beginners Guide</button>

Here, we are tracking the number of downloads of ‘CRO Beginners Guideby tracking clicks on a button.

Another example,

<a href=”https://www.abc.com/gu/dw/social-media-guide.pdf” onClick=”ga(‘send’, ‘event’, ‘guides’, ‘download-social’, ‘social-media-guide.pdf’, 10);“>Download Social Media Guide</a>

Here, we are tracking the number of downloads of social media guide by tracking clicks on a link.

Another example,

<a href=”mailto:[email protected] ” onClick=”ga(‘send’, ‘event’, ‘Email’, ‘click to email’, ‘[email protected]’);“>[email protected] </a>

Here, we are tracking the number of people who sent emails by tracking clicks on emails.

The other but less popular mouse event handlers are ondblclick,onmouseover and onmouseout. All of these mouse event handlers can be used to execute the event tracking code.

Note: You should avoid tracking highly repetitive events like mouse movements because Google Analytics can’t track more than 500 events per session.

If you want to track clicks on external links, clicks on file downloads and other buttons in Google Tag Manager, then read the following articles:

#1 Tracking clicks on external links across a website

#2 Tracking File downloads and other button clicks

Keyboard event handlers in Google Analytics Event Tracking

I have not found any good use of keyboards event handlers in event tracking.

Frame event handlers in Google Analytics Event Tracking

The most common frame event handler is onLoad.

It executes a method after a page, frame or image has completely loaded. For example:

<img src=”popup.gif” onload=”ga(‘send’, ‘event’, ‘popups’, ‘popup-homePage’);“>

Form event handlers in Google Analytics Event Tracking

The most common form event handler is onSubmit.

This event handler executes a method/function when a form is submitted and is often used to tie event tracking code to a form embedded on a web page.

For example:

<form name=”processOrders” action=”process.php” onsubmit=”ga(‘send’, ‘event’, ‘Forms’, ‘Order Submitted’);“>

Other commonly used form event handlers are onBlur, onChange, onReset, and onSelect. All of these event handlers are frequently used for advanced form tracking.

If you want to track forms via Google Tag Manager then read the following articles:

#1 Tracking Form Submissions via Google Tag Manager

#2 Tracking Form Fields via Google Tag Manager

How to Setup Event Tracking in Google Analytics 4 (GA4)?

If you want to set up event tracking in GA4 then check out this article: How to set up event tracking in Google Analytics 4

How to scale and automate event tracking via Google Tag Manager?

The purpose of this article is to teach you the fundamentals of event tracking so that you can use this information to deploy the event tracking code via Google Tag Manager. 

I certainly don’t want you, to manually add event tracking code on each and every web page element, throughout your website. That would be insane, esp. when now you have got the mighty Google Tag Manager at your disposal.

To learn more about event tracking in Google Tag Manager, read the following article: Event Tracking in Google Tag Manager – Complete Guide

How to set up video tracking via Google Tag Manager?

Video tracking is one of the advanced applications of event tracking, where you track the player state (play, pause and the percentage of video played) of single/multiple videos embedded on a web page or across a website of any size. 

However, if you want to scale and automate video tracking, then you must deploy this tracking via GTM.

Here is an article that can help you do that: Video Tracking in Google Tag Manager

How to set up scroll tracking via Google Tag Manager?

Scroll tracking is one of the advanced applications of event tracking, where you can track the length of a page scrolled by users. 

Through scroll tracking, you can get an insight into, how people are consuming your website content. Again, GTM is the best tool to scale and automate scroll tracking on a website.

To learn more about implementing scroll tracking via GTM, read the following article: Scroll tracking in Google Tag Manager

Enhanced ecommerce tracking

Enhanced ecommerce tracking is a very advanced application of event tracking. 

Though it is strictly, not an event tracking application, it heavily uses the logic behind event tracking, to track various types of ecommerce events.

These ecommerce events could be:

  1. Viewing an internal promotion campaign.
  2. Clicking on an internal promotion campaign.
  3. Viewing a product in a product list.
  4. Clicking one of the product links in the product list.
  5. Viewing a product detail page.
  6. Adding/removing products from the shopping cart.
  7. Starting, completing and/or abandoning the checkout process.
  8. Asking for a refund.

In the case of enhanced ecommerce, various ecommerce events are usually tracked via enhanced ecommerce tracking code and not via the traditional event tracking code. 

However, in some cases, the traditional event tracking code can also be used.

Cross-device tracking

Cross-device tracking is the most advanced application of event tracking, where you send event hits from devices other than laptops, mobiles, desktops, and tablets via measurement protocol.

So if you want to send event data from your cash register or washing machine to the Google Analytics server, you can do that by writing a script that sends the payload data to the GA server.

To learn more about, how you can send event data via measurement protocol, read this article: Understanding Google Analytics Measurement Protocol

  1. Google Analytics Ecommerce Tracking Tutorial
  2. Google Tag Manager Event Tracking Tutorial
  3. Google Analytics Store Visits Tracking Tutorial
  4. Offline Conversion Tracking in Google Analytics – Tutorial
  5. Ecommerce Tracking Google Tag Manager (GTM) – Tutorial
  6. Tracking Virtual Pageviews in Google Tag Manager – Tutorial
  7. Google Tag Manager YouTube Video Tracking
  8. How to unlock not provided keywords in Google Analytics?
  9. Google Analytics Virtual Pageviews Tutorial
  10. Google Analytics and YouTube Integration Tutorial
  11. Google Analytics for Facebook Tutorial
  12. Cross Domain Tracking in Google Analytics – Complete Guide
  13. How to use two Google Analytics codes on one page
  14. The one thing that you don’t know about PayPal.com and the referral exclusion list
  15. Google Analytics Calculated Metrics – Tutorial
  16. Creating your own Google Analytics Tag Auditing System
  17. Google Tag Manager Search Tracking without Query Parameter
  18. Tracking Google Analytics Paypal Referral and other payment gateways
  19. How to Track Phone Calls in Google Analytics – Call Tracking Tutorial
  20. How to track leads in Google Analytics via CRM
  21. Postbacks in Google Analytics Explained
  22. Subscription & Recurring Revenue Analytics in Google Analytics
  23. Track the Impact of Google Analytics Cookie Consent on Website Traffic
  24. Tracking Offline Conversions in Google Ads
  25. Implementing Scroll Tracking via Google Tag Manager
  26. Scroll Depth Tracking in Google Tag Manager – Tutorial
  27. Site Search Tracking In Google Analytics Without Query Parameters
  28. Google Tag Manager Youtube Video Tracking via YouTube Video Trigger
  29. How to Correctly Measure Conversion Date & Time in Google Analytics
  30. Google Analytics Social Tracking – Twitter, Facebook, Google Plus and LinkedIn
  31. Cross Domain Tracking in Google Analytics – Complete Guide
  32. Google Analytics Linkedin & Twitter Tracking
  33. Creating Content Group in Google Analytics via tracking code using gtag.js
  34. Google Analytics Site Search Tracking via Query Parameters
  35. Google Analytics Site Search Tracking Tutorial
  36. Creating and Using Site Search Funnel in Google Analytics
  37. Learn to Setup Facebook Pixel Tracking via Google Tag Manager
  38. AMP Google Analytics Tracking – Learn to track AMP pages
  39. Setting up Sales Funnel across websites in Google Analytics
  40. Regex Google Analytics & Google Tag Manager – Tutorial

Frequently Asked Questions About Google Analytics Event Tracking

What is an event in Google Analytics?

In the context of Google Analytics, an event is the users interaction/activity with a web page element that is being tracked in Google Analytics. The web page element could be video, gadget, podcasts, image, button, form, scroll bar, external link, lightbox, Ajax content etc.

What are the different types of events that can be tracked in Google Analytics?

We can have two broad categories of events, one which generates pageviews when they occur like clicking on an internal link on a webpage and another which does not generate pageviews when they occur, such as clicking on an external link, loading of Ajax/Flash content, downloading a file, viewing a video, scrolling a web page, clicking on a button etc. By default, Google Analytics cannot track any event which does not generate pageview when it occurs like: clicking on an external link, viewing a video, downloading a file, scrolling a web page etc. You can track such events only through event tracking or virtual pageviews.

What is event category?

It is the name assigned to the group of similar events you want to track. For example, profitable engagement, reading, YouTube videos etc.

What is an event action?

It is the name assigned to the type of event you want to track for a particular webpage element. For example play, pause, percentage etc.

What is an event label?

It is the name assigned to the web page element, whose users interaction you want to track. Event label can be a title of a video, title tag of a web page, the name of a gadget, name of the downloadable file, etc.

What is an event value?

It is the numerical value assigned to the event you want to track. For example, an event value can be: download time, length of the video footage played or some monetary value.

What is non-interaction?

It is used to designate an event as interactive or non-interactive. This field object can have a value of true or false.The default value is false, which means by default an event is considered as interactive and it impacts the bounce rate calculations. If you want to make an event non-interactive so that it does not impact the bounce rate calculations then set the nonInteraction value to true.

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade
error: Alert: Content is protected !!