With GTM, I am tracking the clicks on all cards containing a certain id (go-to-store-card)
a card looks like this:
<a id="go-to-store-card-vuori" href="https://vuoriclothing.com/" target="_blank">{children}</a>
But the event is only triggered when the user clicks a certain element nested inside those cards.
<span>Go to store</span>
Nothing is tracked when clicking anywhere else on the cards. Any idea why?
I am wondering if there is some kind of confusion with the text being "go to store" on the span
From your screenshot
GTM listen 2 click events
gtm.click and this detect the click from the span.(And you set the trigger use this type)
gtm.linkClick. This detect the
<a>element you are trying to target.So the solution here is change your trigger type from All Elements to Just Links
@A_Patterson mentioned a better way to capture
Here is the html you have
Sometimes GTM will capture the click event from the {child}
There are 2 ways to setup the trigger.
Just Linkand target the element id. BecauseJust Linkwill only focus on the elementAll Elementsand use css selector to capture:a#go-to-store-card-vuori, a#go-to-store-card-vuori *This will trigger when user click the element or anything inside the