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.
- Click the “Links and downloads” tab. This is that setting that will record events on your Drupal site.
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”.
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”).
- Here is the “outbound” category, showing which links people click on to leave our site:
- Here is the “download” category, showing which files people download from our site:
Quite useful. Thanks!
Cheers Anthony