Jun 24, 2015

Recording Downloads and Clicks in Google Analytics

We’re huge fans of Google Analytics here at bwired, but there are some things that it just doesn’t track automatically. Often, this is content that you really need to report on, like downloads of PDFs, clicks on banners, or how many times a video is viewed. Event tracking is the solution, and luckily, it’s reasonably easy to implement, accurate, and you can see the data in Analytics.

The process is to create the script, or the actual event tracking code, then add it to the element on your site. Let’s use the PDF example – in my code, the PDF download looks like this: <a href="http://www.bwired.com.au/downloads/0615whitepaper.pdf">Download a whitepaper</a>. Event tracking is when you add some code to the ‘a’ element so that when this is clicked, it sends the data back to Google Analytics.

  1. You’ll need to decide on a category, action, and label for your event. These can be whatever you’d like, but make them easy to understand for reporting purposes.
    • Category: a word that describes the type of event. Examples are pdf; video; buttons.
    • Action: what the user is doing to trigger the event. Examples are download; play; click.
    • Label: the name of the event itself. Examples are May 2015 whitepaper; Cat Says Hello video; Buy now homepage banner
  2. This site includes a tool which generates tracking code http://gaconfig.com/google-analytics-event-tracking/general-event/ Input your information into the relevant fields provided. The site will then produce the code that you need to add to your event. Copy the code.

    GA Config - Event Tracking Site
  3. In your CMS, click to view the source code for the page your event is on, and find the event itself (this will be the pdf, video, or button).
  4. Within the ‘a’ part of the link, paste in your code. Make sure you paste it after the closing quotation marks for the ‘href’ section. Save and upload your page.

    Adding event tracking code to your CMS
  5. In Google Analytics, go to Real-Time > Events.
  6. On your actual website, trigger one of the events (click a button, download the whitepaper, etc).
  7. Back in Google Analytics, you should see a line appear in the graph which demonstrates that an event has occurred.

    Viewing events in Real Time in Google Analytics
  8. After a day or so, these events will appear in the Behaviour > Events section. You’ll be able to view these by category, action, or label, and can segment and report on them as you’d do for any Analytics data.

Leave a comment