| Drupal
Track Google Analytics Clicks and Downloads in Drupal

Over the last week, several people have asked us about tracking Google Analytics "events" on their Drupal site.

"Events" describe anything from clicking on an external link to leave your site or downloading a file.

We're going to use the Google Analytics module which is available for Drupal 6, 7 and 8.

  • Install and enable the Google Analytics module.
  • Go to Configuration > Google Analytics.
  • Enter your Web Property ID which is in the form of UA-xxxxxxx-yy. If you login to to your Google Analytics account, you'll see the ID next to every site profile.
Enter your Web Property ID
  • Click the "Links and downloads" tab. This is that setting that will record events on your Drupal site.
the "Links and downloads" tab in Drupal

Now that is enabled, try clicking some links or downloading some files on your site. Have patience: the results will take a while to show in Google Analytics.

  • After some time has passed, login to your Google Analytics account.
  • Click "Behavior", then "Events".
The Events tab in Google Analytics

This area of Google Analytics will record the events on your site, including which links people click on ("outbound") and the files they download ("download").

The Events category in Google Analytics
  • Here is the "outbound" category, showing which links people click on to leave our site:
The outbound Events category in Google Analytics
  • Here is the "download" category, showing which files people download from our site:
The download Events category in Google Analytics

About the author

Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.