October 2017
Intermediate to advanced
370 pages
8h 57m
English
Another useful thing to track is clicks on outbound links. We could use the following configuration to track clicks on links:
"triggers": { "outLinkClicks": { "on": "click", "selector": "a", "request": "event", "vars": { "eventCategory": "outbound", "eventAction": "click", "eventLabel": "${outboundLink}" } }}
Then, we can annotate each outbound link with a data attribute:
<a href="http://example.com" data-vars-outbound-link="http://example.com">Some link</a>
A drawback of this approach is that a request will be sent whether or not it's an outbound link, although only the links we've annotated will contain an eventLabel value.
We could remedy this by targeting only the actual outbound links with a more specific ...
Read now
Unlock full access