Analytics Tip of the Week: Build Your Events


By Jay Adamsson

Welcome back to Week 7 of our series: Analytics Tip Of The Week.

Every Monday morning we’ll be providing a quick tip for your website Analytics. We’ll be presenting topics not just as a “how do I do this”, but “how can this help me”. Data alone may be interesting, but it’s only when we use the data that it becomes valuable.

Quite often, our tips will be Google Analytics related, but not always. Remember, there is a lot more to website analytics than just Google Analytics. We can’t forget other properties like your social media analytics, how best to implement Google Analytics, and perhaps the most important of all: reporting results in a way that makes sense and prompts continual improvement.

What Is An Event?

In Google Analytics, an event is an action taken on your website that is captured and tracked in GA. With the basic Google Analytics, all that is tracked are Pageviews – what pages are loaded by your users. But that is only a small part of the picture. There is very limited intelligence to be gained from just looking at Pageviews (and some of the information can even be misleading). You have to go one step further, and the best place to start are with events.

Events are very important for proper website tracking and evaluation since they take GA out of the realm of pages loaded and start answering, “what did a user actually do on my site?” Remember last week’s discussion about conversions? Often, a conversion will not be a page visited on the site. More likely it will be something like a purchase, a download, or sometimes even successfully sending a visitor to another website. These are the important actions that users take on your website, but they aren’t captured in Google Analytics without a little bit of work.

The Structure of an Event

An event is made up of four components:

  • Category: This is a group description used to gather multiple similar events. For example, categories might be “Resources”, “Video” or “Banner”.
  • Action: An event is an action taken on your site. This component describes what the action is. For example, actions might be “Download”, “Play”, or “Click”.
  • Label: This is a descriptive field. Common uses of this field would be the filename of a download, the page on your site where a video is played, or the external page the user navigates to from your site.
  • Value: This field is optional, but very important. It allows you to specify what the event is worth. After all, events are often used to track conversions – important actions on your site. If an action is important, it should have a value.

Providing a value for an event is a topic on its own. Sometimes it’s easy to calculate – how much did the user just spend on your site. Sometimes it’s much more difficult – what is a download of your report worth?

Use Tag Manager To Capture Events

Capturing events in Google Analytics is where Tag Manger starts to shine. If you have added Google Analytics to your site without Tag Manger, you have to add custom JavaScript right into your website code. At best, it’s a tedious process. At worst, you have to hire a developer to do the job.

But with Tag Manger, it’s a matter of setting the proper triggers and tags without having to reprogram your website.

Let’s look at two of the most common events that are tracked: Downloads and External Links.

Setting Up Click Variables

Google Tag Manger Click VariablesRecall that Tag Manger has three main parts: Variables, Triggers and Tags. In this case, we’ll assume that your basic tracking is already set up, so we just want to add in tracking of downloads and external links.

Before we get into details about creating an event to capture downloads or external clicks, there is one step we have to do with Tag Manger involving Variables. In Tag Manger, click on Variables on the left side, then under the section entitled “Basic Variables”, click on the “Configure” button.

This gives a list of a number of built-in variables that Tag Manager provides, and which make life a lot easier. Look for the section called “Clicks”. Turn on everything in this section. We won’t actually make use of all of these, but once you get into more advanced tracking, they will all be useful, so you might as well turn them all on now.

Tracking Downloads

Tag Manger essentially keeps an eye on your site as users interact with your site. The Trigger tells Tag Manger when to do something. In this case, we want Tag Manager to send data to Google Analytics when a file is downloaded. So, let’s set up a Trigger to capture when a file is downloaded.

In Tag Manger, click on Triggers on the left side. We need to tell the system to do something when a link is clicked, and that link is for a file to download. So, click on Trigger Configuration and choose “Just Links”.

Like this, you will have a trigger that fires whenever any link is clicked, so we have to limit it some more. Choose “Some Link Clicks”. In the first box, choose “Click URL”, and in the second box, choose “matches RegEx”.

What is RegEx? That’s a topic for later.

Finally, the last box is where you tell the trigger that you are only interested in certain files. It is also where things can get a bit tricky because we have to know what the possible file downloads might be. Common ones are .pdf, .doc, or .xls files, but you might have other types of files on your site and each of these file types have to be included here. For now, set this final field to read the following:

.(pdf|xlsx|xls|png|docx|doc)$

Make sure you include the period in front and the dollar sign at the end.

Give your Trigger a name (such as Event – Link Click on Download), and save it.

Google Analytics Download Trigger

At this point, you have told Tag Manger to do something when a file is downloaded, but you have not yet told it what to do. This is where you have to create your Tag.

On the left side, click on Tags, then “New”. Click on “Tag Configuration”, then “Google Analytics – Universal Analytics”. Change the Track Type to “Event”. You should now see the four event components that were described earlier. Set the following:

  • Category: File
  • Action: Download
  • Label: {{Click URL}}
  • Value: 1

Finally, under Google Analytics settings, select your Settings Variable that you should have set when you first set up Tag Manager.

What are the double braces {{Click URL}}? That means you are referring to a variable. You can also choose the variable from a list cy clicking on the small block at the side of the input box.

Now, you just have to associate your trigger with the event. At the bottom, where it says Triggering, click in this area and select the Trigger you just created. Now give your tag a name (such as UA – Event – Download) and Save.

Finally, you have to make your Tracking live, so click on “Submit” and give a Version Name (such as Download Tracking), and click “Publish”.

Make sure you now test your updates, but your Google Analytics is now keeping track of file downloads from your site.

Google Analytics Download Tag

Tracking External Link Clicks

Another common event is keeping track of when users click on an external link from your site. Especially if you are using your site to promote others, or if you sell banner advertising on your site, this is something you want to know about.

Again, you need to use a Trigger and a Tag.

For the Trigger, again create a new Trigger with Just Links as above, and choose “Some Link Clicks”. Set the first box to “Click URL”, the second box to “does not contain”, and the third box to whatever your URL is (such as aorweb.ca). This creates a trigger that fires whenever a link is clicked that does not contain your home URL.

For the Tag, again create a Universal Analytics Event tag as above. For the four components, choose

  • Category: External Link
  • Action: Click
  • Label: {{Click URL}}
  • Value: 1

You may want to adjust the Value depending on your own circumstances. Add in the Trigger you just created, name your Tag and save it.

Now Publish your changes, and your Google Analytics is now tracking external links that are clicked on your site.

Next Steps

Event tracking is one of the most powerful and versatile things you can and should do to evaluate your website. These are just a couple of examples of things you can track, and the particulars for your site will depend on your conversions and what is important to you. There are lots of resources online about how to set up tracking for many particular actions, such as completing forms, viewing more details, subscribing to a newsletter, and many other actions.

Supportscreen tag