Tracking the basics in Google Tag Manager


I have recently had to set event tracking on a lot of Google Tag Manager containers for various clients. Through that, I have had some time to think of standard events I usually end up setting up. These are:

  • E-mail clicks
  • Phone clicks
  • Social Link Clicks
  • Outbound links
  • Downloads

I therefore did what everybody else would do – No I am not talking about coding it… I made a Google search to find a script that contains everything. Unfortunately, I could not find it, and from there i decided to team up with an x-collegue Markus Kelle, who already build something similar. with a few adjustments and add-ins, the script was in place and ready to share:

The script

Setting up the tag – The howto guide

1. Creating event variables

The event variables are used to capture the data the script pushes to the dataLayer.

2. Setting up the event

Next step in the process is to create the event itself. This makes us able to push the data into Google Analytics.

3. Adding the script to the site

The script is build with a logic saying: If a specific predefined link is clicked, then push an event which our event tag can use to send the information to Google Analytics with.

4. Testing if it works

The last step is triggering events on the site, to see weather they fire. In this case i have used GTM’s own debugger to make it easy to verify.

Final Words

This script is by no means perfectly coded, or intended to be the one and only solution to tracking basic link tracking on your website. This is just one out of many approaches that works for me. Feel free to use it, or comment if you feel that you have a better solution.  meanwhile, i hope you enjoyed this small post and that it is of use to you.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.