First, let’s define what “non-page activity” means: non-page activity is any action that happens on your website that isn’t a page load or page view. That includes: button clicks that don’t lead to a new page, media player uses, and file downloads.

Google Analytics, and any other javascript-based site tracking tool, can’t track the activity of any area of your website where the tracking script doesn’t appear. That means that the PDF link you put up won’t get tracked in your regular reports without some extra effort.

The easiest and most detailed way to track these sorts of things is to implement something called Event tracking.

First: Are you using Universal Analytics, or original flavor Google Analytics?

If you aren’t sure, do this:

  • Log into Google Analytics
  • Go to Admin (upper navigation, furthest option to the right)
  • Expand the “Tracking Info” section under Property (center column)
  • Click Tracking Code

Click to make bigger

If the tracking snippet looks like this, It’s Universal:

universal tracking example

If the tracking snippet looks like this, it’s classic GA:

old tracking code
Pulled from the developer docs area.

 

If you’re running Classic Google Analytics, I’d recommend upgrading before proceeding to implement Event tracking. It’s relatively painless, and they are working on making Universal the standard for all GA users in the not-too-distant future.

Second question: Are you running WordPress, or using a different way to manage your website content?

If you are running WordPress, I highly recommend picking up the GA plugin created by Audrius Dobilinskas. They make tracking all types of downloads and outbound clicks as simple as a checkbox. Let’s run through this, as it’s the quickest and easiest way I know of to get file download and outbound link tracking into place.

Installing and Using a GA Plugin to Track Downloads as Events

Search “google universal analytics” in the plugin installer of WordPress and this will be the first option. Select Install, and after installing, activate the plugin.

You’ll have a new menu at the bottom of your WordPress left hand menu options called Google Universal Analytics, with a gear icon.

Click this to go to the default page, which is the settings for Universal Analytics. This plugin also provides options for Classic Analytics, and custom code.

UA settings

You’ll need to set the status to “on” and plug in your Tracking ID into the box. You can get your Tracking ID by following the same steps you used earlier to see which version of GA you are running. You can also get your ID from the Property Settings page, seen here:

property settings

To track your file downloads and outbound clicks, check the box next to “Track Events”.  Make sure to save your settings!

That’s it. You’re done. You’re now tracking your site visitors, outbound clicks, and downloads.

The default behavior is to track outbound clicks and downloads as Events.

Let’s Talk About Event Tracking For a Sec

Pros of using Events:

  • Neat, separate reporting
  • 4 distinct reports: overview, top events, pages, events flow

Cons of using Events:

  • Very few!

Events reporting is pretty robust, and it does allow you to see what pages the actions occurred on, which will allow you to backtrack as needed.

You also get 4 possible layers of labeling for events: Category, Action, Label, and Value.

Category is the grouping, such as “File Downloads” or “Videos”.
Action is a sub category to track the literal action that takes place in the event, such as “play” or “share” or “download”.
Label is a third tier of labeling you can use to get specific about the action in that category where you can put file names or other types of classifications, such as “PDF newsletter 34″‘ or “My Movie Unabridged”.
And finally Value, which is any positive number you can use to assign numeric value to your event.

Ok but I don’t have WordPress, so what do I do?

don't cry! We got this!

Ok. So you’ll need to have the ability to edit pages on your website and/or the ability to write and implement basic jQuery.

It’s not as bad as it seems. The GA Developer Docs has the details of integration using jQuery, but allow me to paraphrase to save you a trip. (Frankly that’s one of the worst looking developer documents I’ve ever seen them put out. Clear as mud!)

If the idea of implementing jQuery sends you into a state of low grade shock, do not panic. You can make on page changes to your links to implement Event Tracking.

Andy Forsberg put up a piece on Penguin Initiatives that has some great examples of how to implement Event tracking with GA Universal by hand. It’s generally geared toward WordPress, but it can certainly apply to any site where you have the ability to edit pages and add files.

The part that applies to you, the not-really-a-coder reader, is this:

<div id="text-27">
 <h3>Subscribe</h3>
 <div>
 <a onclick="ga('send', 'event', 'RSS', 'Click', 'All Pages - Sidebar Widget - RSS - Text Link');" href="http://penguininitiatives.com/feed/">RSS</a>
 </div>
</div>

By adding an onclick event to your files and outbound links, you can track these things as Events. Easy-peasy, right?!

Now, a few things you need to know:

  1. The part that reads onclick=”ga(‘send’, ‘event’,  always has to be there, or it won’t work. This is the part that tells your browser “When a visitor clicks this, tell GA to send an event. Everything that follows after that are your semantic labels.
  2. Always make sure your Event ends with ‘);”  if that tiny bit of syntax is off, your Event won’t work. This is easy, but picky.
  3. The order of items after ‘event’, are: Category, Action, Label, and Value. Category and Action are required every time.
  4. Make sure each thing is wrapped in single quotes ‘like this’ and followed by a comma, ‘like this’, 
  5. Don’t use double quotes, single quotes, or commas in Category, Action, Label, or Value. Something like ‘joes chicken shack’, would break your event. Why? Because of the single quote (aka apostrophe) in “joe’s”.
  6. Keep it simple. Come up with Categories like “Files” and “Outbound” to use on all your file downloads and outbound links. Use Actions that are very clear, like “download” and “click”. Use Labels to get more detail, like “2014 TPS Report” or “Corporate Blog” to earmark specific files and links.

Test The Heck Out of Event Tracking

No matter what method you use to implement any type of new tracking, always, always, ALWAYS test it to make sure it’s working. Always. Seriously. ಠ_ಠ

The easiest way to test is to use the (constantly improving) Real-Time reports, which includes specific real time reporting for Events.

 

real time menu event

 

Click on your newly Event-tagged links, and watch for results. If you aren’t seeing anything, get friends and co-workers to click them also. If you still aren’t seeing anything after a minute or more (it’s really fast, it should be within a minute), then it’s time to debug!

After you get Event results in the Real Time reports, you need to follow up with the Event reports themselves. Check the Category, Action, Label, and Value for your tests. Does it meet your expectations? If not, it may be time to go check your implementation.

That’s it! Use it in good health!

 (ノ◕ヮ◕)ノ*:・゚✧

Edit: In a move straight out of the Irony Department, I installed and deployed Yoast’s GA plugin… without testing it. I discovered that my traffic from the last few days had no events! Whoa!

I did a few tests myself, and although the tracking code that plugin uses does capture traffic just fine, it was not sending Event data for outbound clicks. I suspect it has to do with the fact that my account has been upgraded to use Universal Analytics, while the code Yoast uses relies more on the older version.

So what you see above is a revised post, recommending a newer plugin that I have tested and does work. A little searching reveals that Yoast’s GA plugin isn’t supporting Universal Analytics, which is disappointing because their other plugins are actually quite good and are maintained regularly.

So not only is this a lesson in the follies of hastiness and blind trust of plugin creators, but it also hammers home: ALWAYS TEST.

Another Edit: Hey, so the plugin that I’ve switched to? Well, there was an update on 5/12/14 and now they provide eCommerce tracking support for WooCommerce, which is a highly popular online store application for WordPress. This plugin rules!

One More Edit: They had to remove the WooCommerce tracking feature due to compatibility issues. Still rules though. 🙂