How to Set up Google Analytics Event Tracking

google analytics event tracking

Google Analytics Event Tracking is a great way to track user events on your website such as clicking on social media icons, email addresses, file downloads, or links.

What is Event Tracking?

Event Tracking is a feature in Google Analytics that allows you to track various types of custom user events on your website by collecting event data about various user actions.


Learn how to get Google Analytics Individual Qualification certificate to leverage google analytics event tracking for your organization.


How to Set up Google Analytics Event Tracking

1. Decide what you want to Track

The first step to set up event tracking in google analytics is to decide what you want to track. You can track any kind of clicks using Event Tracking for Google Analytics, whether it is infographic download, form submission, clicking an email address, or even social sharing icons.

The trick is to track those events which help you measure your Marketing Goals. For example, if your marketing goal is to develop whitepapers as a new lead channel, and you just published a whitepaper this week then tracking its downloads would be very useful in tracking your marketing goals.


Bonus Read : 8 Most Important Google Analytics Metrics Every Business Should Track Regularly


2. Add the code for Google Analytics Event Tracking

The next step is to add the event tracking code to the download link of your whitepaper. Basically, you need to add the code to the onClick value of the link whose clicks you want to track. If you’re tracking social shares, add it to the social media icon links.

Here is the basic code that you will need to start with (for the async tracking code of Google Analytics):

  • onClick=”_gaq.push([‘_trackEvent’, ‘Category’, ‘Action’, ‘opt_label’, ‘opt_value’]);”

If your site is using Universal Analytics, you’ll need to use this code:

  • onClick=”ga(‘send’,’event’,’category’,’action’,’opt_label’, ‘opt_value’);”


In the above code, category, action, opt_label & opt_value are variables you need to replace with suitable values as per your requirement. You’re essentially sending these values to Google Analytics whenever user clicks on your link.

  • Category – Tracking groups to group events
  • Action – the action a user takes
  • Opt_Label – label to differentiate this event from the others (optional)
  • Opt_Value – A Number to provide additional numerical data about the event (optional). Also called google analytics even value.

Since we want to track user downloads of our whitepaper, we’ll use the following values for our variables

  • Category: downloads
  • Action: click
  • Label: whitepaper
  • Value: 0

So, now our code looks like

<a href=”<link_url_here>” onClick=”_gaq.push([‘_trackEvent’, ‘downloads’, ‘click’, ‘whitepaper’, ‘0’]);”> <link_text_here></a>

For universal analytics, it will be

<a href=”<link_url_here>” onClick=”ga.send(‘send’,’event’, ‘downloads’, ‘click’, ‘whitepaper’, ‘0’);”> <link_text_here></a>


3. Tracking Events in Google Analytics

To see Event Tracking Reports in Google Analytics, open Behavior Menu on the left, and click Overview link under the Events sub menu. This will show event information up to the previous day.

event tracking behavior menu

If you want to see real-time event tracking, you can do that by clicking Events option from Real-time menu.

event tracking real time

You can use Google Analytics Event Tracking to track a variety of custom events such as Banner Ad clicks, Social link shares, Video Playback, For submission, Emails, and Call-to-Actions. Google Analytics Event Tracking enables you to track wide range of custom events with ease. You can even set up goals in google analytics to measure conversion rates for these events.


You can also create custom Google Analytics Dashboard and Google Analytics Reports to track events, metrics and goals for your business.


How do you run Event Tracking in Google Analytics ? Share your experience with us.


About Sreeram Sreenivasan

Sreeram Sreenivasan is the Founder of Ubiq, a business dashboard & reporting platform for small & medium businesses. Ubiq makes it easy to build business dashboards & reports for your business. Try it for free today!