Hosting Tutorial & Guide

How to Set Up Google Analytics Event Tracking on Your Website

updated on Nov 04, 2015
How to Set Up Google Analytics Event Tracking on Your Website Google Analytics tracks the page views, bounce rate, time spent on a page, etc. as long as it is set up. However, most users have ignored many other powerful features that are not enabled by default. Event tracking is exactly one of them.

This post is a beginners' guide to Google Analytics event tracking, explaining briefly what it is, and showing how to set up event tracking manually and using Google Tag Manager.

What Is Google Analytics Event Tracking?

Google Analytics comes with many hidden gems, and event tracking is among them. Event tracking gives you the capability to measure the user interactions that are not monitored in the default integration of Google Analytics. These interactions usually do not generate a new page.

Now, more and more webmasters are using event tracking to:
  • Track AJAX-based form submissions. Form errors can also be known.
  • Track click-based file downloads. You can see how many times a file is downloaded, and which download button is clicked most.
  • Track video engagement. If you have embedded videos on your site, you can monitor both the engagement and behaviors which include starts, plays, and stops.
  • Track affiliate links and get the stats like sales, payments and leads.
By gaining insights into the website behaviors, you can adjust your content strategy to improve the user engagement thus increase the conversions and sales. In below, we will introduce how to track the events/behaviors on your site.

Set Up Event Tracking Manually

Before getting started, you have to make sure that the Google Analytics tracking code has been installed on all the pages for which you want to configure event tracking. If you have problems with this, refer to our Google Analytics tutorial.

Besides, you need to confirm that you are using the new Universal Analytics instead of the old tracking library which will be deprecated by Google in the near future. Have a check on your tracking code, and if the code looks like what shown in below, you don't need to do anything because you are already using the new code. But if it does not, you have to make an upgrade.

Google Analytics Tracking Code

When you have made the proper preparations, you can follow the tutorial below to start using event tracking.

Create an event in Google Analytics

Log into your Google Analytics account, and then go to the Admin dashboard. Here you can see three columns named "Account", "Property" and "View". What you need to do is to navigate to "View" and click on the "Goals" link. If you have multiple websites under management, make sure that you have selected the right website in the drop-down.


On the new page, click on the red "New Goal" button.

New Goal

For the first step – Goal Description, you have to deal with the following things.
  • Name: Give a title to the goal so that you can identify it later in Google Analytics.
  • Goal slot ID: Keeping the default value is OK if you do not have any special requirement.
  • Type: Select the last one "Event".
Goal Description

Clicking on the "Continue" button will lead to the next step – Goal Details. For this step, you have more important information to deal with. The event conditions are especially important because a conversion will be counted only when all of these conditions match.
  • Category: Enter the name of an entire group of similar events that you would like to track, such as "videos", "ebooks" and "links".
  • Action: Enter the name of an action the event will perform for tracking. This can be something like "download", "share", "pause" and "play".
  • Label: Enter the additional information you want to add to the webpage element that you will track, such as the video title and the name of a PDF file.
  • Value: For most event tracking, the value "0" works. But if you want to add a value that can be calculated, for example, the download time, you can specify a custom numerical value.
When you have finished the event conditions, check the option for using the event value as the goal value, and then click on the "Save" button.

Goal Details

Now you have successfully enabled the tracking of an event. You can see the newly created goal is listed in a table. Make sure that the option for "Recording" is "ON".


Since the event tracking is enabled, you should then add it to your website to gather data in Google Analytics.

Add Google Analytics event tracking with the onClick method

If you prefer to manually add code to your website, you can use the onClick method to send data back to Google Analytics every time an element is clicked. This method is quite easy and quick to use since you only need to add some parameters by yourself. The format is like below.

onClick Method

When you add the tracking of an event, you should replace "category", "action", "label" and "value" with the event conditions specified in Google Analytics. To make an example, if you would like to track the clicks on a download link with anchor text "Download SEO Ebook", you need to add onClick to the link so it looks like this:

<a href="" onClick="ga('send', 'event',
 'Downloads', 'click', 'SEO Ebook', '0');">Download SEO Ebook</a>

Now you have done all the things right. When the link is clicked, Google Analytics will receive an event which you see in the site reports.

Set Up Event Tracking with Google Tag Manager

With the manual method, you have to add much code to your website if there are many elements to track. If you do not like dealing with the code directly on your site, then you can use Google Tag Manager, an easy-to-use tool which allows you to manage various tracking code as tags in a single dashboard. With this tool, you no longer need to edit your site.

Besides ease of management, Google Tag Manager is also good for speeding up your site since no additional code is added. Not familiar with this tool? Follow this tutorial to get started and add Google Analytics tag.

As long as the Google Analytics tag is created, you can start setting up event tracking immediately. To make an example, we will show how to track form submissions.

Create a trigger

When you are in the Container dashboard, click on "Triggers" in the sidebar menu.


Click on the red "New" button.

New Trigger

On the creation page, the first step is to choose the event. Here, you need to select Form.


For the second step, uncheck the "Wait for Tags" and "Check Validation" options, and then click on the "Continue" button.

Configure Trigger

The third step is to choose the form for which you want to fire the trigger on. In the case that you page includes one form only, you can select the former option "All Forms". But if the page includes two or more forms, you have to choose "Some Forms".

Fire Trigger on All Forms

At last, rename the trigger and save it.

Rename Trigger

Create a new event tracking tag

In the Container dashboard, click on the "Tags" menu in the sidebar, and then choose to create a new tag.

Create a New Tag

In the tag creation wizard, the first step is to choose the product. Here you have to select "Google Analytics" and then click on "Continue".


For the second step, choose "Universal Analytics" as the tag type.

Tag Type

Now, provide your UA tracking ID which can be found in the tracking info of your Google Analytics account. For the "Track Type", you have to select "Event" from the drop-down, and then enter the category, action, label and value. In our example, we use "form" as the category, "submit" as action, "contact form" as label, and "0" as value.

Track Type

For the last step, click on "Form" to fire on. A pop-up window will appear in which you need to select the form trigger created before. You can also create a new trigger.

Choose the Trigger

Finally, review all the steps and the information, and click on "Create Tag". Also, remember to rename the tag.

Create Tag

Since saving the tag does not publish it automatically, you need to publish it manually by clicking on the red "Publish" button on the top right of the tags page. You can also preview the changes first.

Publish Tag

Now you can test the event tracking by going to your website and submitting the form. You will see the event is recorded in Real Time > Events in Google Analytics.