How to set up event tracking, what sort of things you can record, and tips on where to get the code to get you started.
Transcript
Hi, this screencast gives you an overview of Google Analytics Event Tracking. If you're just relying on page views and visitor numbers as the main things you're reporting on in your website reports, you're missing out on a whole lot of data. You don't get event tracking with Google out of the box automatically, you need to add it to your site.
I'm going to give you a quick overview of how you can go about setting it up and what sort of things you can record, and then I'll give you some tips on where to get the code to get you started.
We use event tracking on the Web Toolkit website to record things like downloads — different documents that people might get from the site. In this case, we've got the same document but two different file versions. We can track both of those. We also track external links to other websites. Now this gives us data about how many people are visiting these sites. We don't have access to the analytics of all of the sites that we're linking to, so event tracking is the only way to do that. You don't get it out of the box, you need to add some extra script to your site to make it work.
Now, one thing it won't tell you is whether people actually open the documents that are downloaded from your site. They might just have downloaded it to their machine first. It may depend on what their browser does when they click on the link. Same with tracking links out to the external sites. Once they've followed the link, it's pretty well impossible to know what they've done, unless you do have access to the analytics for the site that they've gone to. But you can look for the referrer information back to your site. It may be a sign that they clicked back.
On the Web Toolkit site we also have some extra event tracking. We customised the script that we use. And when people on the search results page change the philtre between site pages, blog posts, and viewing all types of content on the site, we record what their preferences are. We were interested in the user behaviour. What were users showing as their preference when looking for information? The reality is, not many people changed from the default setting.
Now, the event tracking data shows up inside your Google Analytics account in real time. You can see the current activity for active users, and activity for the previous 30 minutes. That information also appears in the Behavior > Events section of your reports. Look at the top events report. Here you can see the event categories that we've asked the site to record for things that people do on the site. It's really important you make those categories meaningful, because you'll need to use that as part of your report.
You can drill down into a category, like you would with a content report. Here we've drilled down into the file extensions. Not the most useful thing to report on. We actually need to report on the event labels. This is the file name, the actual thing that somebody downloaded. And, I can make this report more useful too. There's two things I'll need to do. The first is I'm going to add a secondary dimension and use Page. This is going to show me the actual page that users were on, on the website, when they downloaded that particular file.
Now, I'm really interested to find out what was going on with those accessibility guides for MS Word. So I can also filter this report like I would filter any other report in other screens. And now I can see just the information that relates to those particular files. And I can see they've only been downloaded from the one page. And that's fine, because they're only linked from that one page on the website.
Now, if you're interested in getting the code, go to the Web Toolkit and search for the word free code. You'll see a blog post, "Free Code: Event Tracking for Google Analytics", will appear. This post contains a little bit more information about event tracking. More importantly, it contains two different files that you may wish to use.
If your site uses jQuery, you can use the jQuery version. If your site just uses plain JavaScript, use the other version.
Now it's really important for your production site, you should use the minified version of that file, to keep it as small as possible. You may also want to consider aggregating the JavaScripts together even further, to reduce load on the server. You can customise the code that we have, you're welcome to experiment, add more things, or change some of the settings.
If you’ve got questions or feedback, we’d love to hear from you. Email us at info@digital.govt.nz or visit the Web Toolkit for more information.
Other screencasts in this series
See the first post in this series for the full list of screencasts.
Give us your feedback
We’re looking for feedback from agencies on how well these meet their needs, and if they’re popular, we may be able to produce more. If there’s a specific topic you’d like to see covered, let us know. I’m moving on to new opportunities in Australia, so email info@digital.govt.nz and someone from the Digital Engagement Team will get back to you.