2
votes

I am trying to implement google analytics with outbound clicks tracking using Google Tag Manager. I have the following tags set:

Google Analytics Universal - Page View - Firing rules: All pages

All Clicks - Link Click Listener - Firing rules: All pages

External Links Tracker - Universal Analytics - Event - Firing rules: External link

The external link rule is defined as follows:

{{event}} equals gtm.linkClick

{{element url }} does not start with http://example.com

{{element url }} does not start with http://www.example.com

When I run the GTM in debug it seems to be working but when I publish it, it does not work. Analytics only collects the normal traffic but no events for outbound clicks.

Any ideas?

3
I would emphasize that the issue is when I push the code. In debug mode, it works ok. I can debug the events being fired. But not when live.checklist

3 Answers

1
votes

checklist,

I think the answer is quite simple - you have to create two rules, because if you include both conditions (with WWW and without WWW), you have to consider the operator being used. GTM in using using AND operator by default, so this tag would fire if both of the conditions would be matched AT the same time. Which will never happen :)

To avoid a situation when you URL is in {{element url}} (as a parameter), creating a simple rule with regular expression should do the trick:

Rule 1) Outbound WWW

{{event}} equals gtm.linkClick
{{element url }} does not match RegEx ^http:\/\/([a-z]*\.)?example\.com
0
votes

Try {{element url}} does not contain example.com

0
votes

What about:

{{element url}} does not match regex  ^http://(www\.)?example\.com