When first dipping my large toes into Google Tag Manager all those years ago…and still now to be honest, I often forget exactly what data certain built-in variables will provide you with. So I am doing the sensible thing and writing them down for the whole world to see.
Overview
The quickest way to cover what the different variables do, is a quick show and tell. If you want to track a link that is:
<a href=”https://mattrhysdavies.co.uk/i-want-to-track-this-link” target=”_blank”>Some Anchor</a>
Then in this instance the Click Target would provide you with the value of _blank whereas the Click URL would provide you with the value of https://mattrhysdavies.co.uk/i-want-to-track-this-link. I’ll go into a little further detail below.
Click Target
The click target will allow you to record into GTM the value of the target attribute on the <a> tag. The value of this will be one of the following defined values.
Value | Action |
---|---|
_blank | Opens the linked resource in a new tab |
_self | Opens the linked resource in the same tab in which it was clicked. This is the default behaviour |
_parent | Opens the linked resource in the parent of where it was clicked. |
_top | Opens the linked resource in the full body of the window in which it was clicked. |
So this can be useful to track how users response to clicking links on the web property that behave in different ways. For example, I expect if you open each new page using target=”_blank” I would expect a quicker user exit rate than using the default behaviour of “_self“.
Click URL
At the risk of outing myself as a true geek, the Click URL variable is one of my most useful go to tags; as it will allow you to pass in the value of the click destination; which is particularly useful if you have a list of items that you want to track that all have the same class. You can then pass an event into Google Analytics, passing the click destination as a value.
A full list of the GTM variables can be found at the ever useful Simoa Hava’s blog.