Analytics
6.8K members online now
6.8K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

GTMs event tag with click trigger caputres false events - How to troubleshoot?

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Setup:

I implemented event tracking for a website's navigation with a tree-like structure by adding click event listeners to the links in the navigation. These event listeners push information to the dataLayer, which in turns fire event tags capturing the information of the clicked navigation element.

 

The event tag looks as follows:

event category: 'navigation' << fixed string

event action: {{navigation layer}} <<This can resolve to such values as 'First level' or 'Second level' depending on where the link can be found within the navigation. 

event label: {{ClickURL}} << GTMs built-in variable. This should resolve to the href attribute of the clicked link.

 

Problem:

 

In some cases the {{ClickURL}} does not resolve to any navigation's element href attribute. Some of the logged events have URLs with gclid query parameters from existing AdWords campaigns for their ClickedURL. I found the responsible campaign, but I can't emulate events with gclid-URLs. In GTMs Preview Mode everything works as it's supposed to.

 

GTM Implementation:

Attached to the event tag mentioned above is a link click trigger. This trigger fires when Click element matches CSS selector #nav a. This selector is unique to tags in the navigation bar. The 'nav' id should thus prevent the event from firing except for links that are part of the site's navigation. 

 

It should be impossible for the event to fire with an AdWords URL as they are not part of an clickable element on a website.

 

Does anybody have an idea how to troubleshoot this? 

  • I do know this problem is not tied to a:
    • single device
    • browser or OS
    • screen resolution
  • The CSS selector is definitely unique to anchor tags of the navigation bar

 

Any help is appreciated. I'm running out of ideas how to debug this.

Anyone? Please let me know if I need to elaborate in more detail.

Re: GTMs event tag with click trigger caputres false events - How to troubleshoot?

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭

Hi David

 

If it is OK, is it possible to describe tha capture of the configuration page of Google Tagmanager? Information that can not be disclosed can be painted black.

 

Thanks.

Re: GTMs event tag with click trigger caputres false events - How to troubleshoot?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hey Ryota,

 

I guess I can provide an simplified example. This is the Event Tag:

abo nav tag.PNGEvent Tag

with the following trigger:

abo nav trigger.PNGEvent Trigger

Leading to the following capture with GTM Preview when a navigation element gets clicked:

gtm debug 1.PNGGTM Preview

Both the original as well as this simplifed version lead to captures like this:

ga resolved links.PNGGA Incoming event data

After looking at the DOM structure of the navigation I might have found the culprit. Someone left an anchor tag with a simple hash reference that does not show.  This anchor tag always resolves to the URL in the browser bar.

Nav DOM Structure.PNGDOM Structure of Navigation

My guess is that {{Click URL}} tries to bubble up to the node where GTM is waiting, but is overwritten by this a tag along the way. I issued a ticket with our development team to remove the tag. Anyways, does this sound plausible?

 

 

GTMs event tag with click trigger caputres false events - How to troubleshoot?

Follower ✭ ✭ ✭
# 4
Follower ✭ ✭ ✭

Hi David

 

What are you thinking to put in the "Event Label"?

Besides, what is the definition of "{{Click URL}}"? 

Maybe it is not the URL of the element you clicked but it is the URL of the page? Please show me the "Click URL" variable configuration.

 

 

Thanks

 

GTMs event tag with click trigger caputres false events - How to troubleshoot?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

{{Click URL}} refers to the built-in variable Click URL

 

GTMs event tag with click trigger caputres false events - How to troubleshoot?

Participant ✭ ✭ ☆
# 6
Participant ✭ ✭ ☆

Hi David!

{{Click URL}} variable always return full URL.
So when your domain is www.example.com and you'll click the link to /contact.html the {{Click URL}} variable will return http://www.example.com/contact.html

If you click the link to an external page (e.g. http://www.google.com) the {{Click URL}} variable will return http://www.google.com address.

But if you click the link with # as a href the {{Click URL}} variable will return the current page URL with # at the end.

 

Thats why if someone clicks on an ad and get to http://www.example.com/contact.html?gclid=xyz page and then clicks some link with # the {{Click URL}} will return http://www.example.com/contact.html?gclid=xyz#