How to Track Downloads in Google Analytics

Downloads such as PDF, piece of code etc. can be tracked as Events in Google Analytics.

Event tracking requires

  1. Calling trackEvent function
  2. trackEvent function can take up to 5 parameters, of those 2 are required

What are those parameters for trackEvent function

  1. category (required) The name you supply for the group of objects you want to track. It can be anything but be consistent with whatever you decide to use.

I suggest using “Outbound Links”  for outbound link tracking

  1. action (required) A name for the type of user interaction for that event.  But again you can use anything you like e.g. “Click”,“Partner Link Click” or whatever makes sense for your business.

I suggest that if you have different categories of link then use the category name that defines those links.

  1. label (optional) A string to provide additional description for that event.

I suggest using the actual name of the links e.g., etc.

  1. value (optional) An integer that you can use to provide numerical data about the user event.

You can leave this value in case of outbound links or use 1 unless you want to give more weights to certain links.

  1. non-interaction (optional) Boolean value, set as true or false

true= not a valid interaction, count it as a bounce

false = considered a valid interaction (default)

If you DO NOT set this value then an outbound click will be considered as a valid interaction thus WON’T BE COUNTED in BOUNCE RATE.

Suggestion: Since you really do want people to click on outbound links, set this value to true e.g. it is a valid hit and not a bounce.

How to call it?

_gaq.push([_trackEvent(category, action, label, value, noninteraction));


_gaq.push([‘_trackEvent’, ‘Download’, ‘eBook’, ‘How to Use Google Analytics’, 1, true]);

So your code will like

<a href=”howto.pdf” onClick=”_gaq.push([‘_trackEvent’, ‘Download’, ‘eBook’, ‘How to Use Google Analytics’, 1, true]);”>Download How to Use Google Analytics eBook</a>

Also see:

How to Track Outbuond Links in Google Analytics
How to Track a Non-Pageview Events in Google Analytics

Leave a Reply

Your email address will not be published. Required fields are marked *