5.3K members online now
5.3K 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

Event tracking through GTM not working

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Below are screenshots from a tag I set up using the Google tutorial for event tracking. I would like to track a link click that opens a modal.


The variable (click URL):



The trigger (my link has the class "firstModal" set):



The tag (the Google Analytics setting contains my tracking code ID):



When I turn on tag recording this is captured by tag assistant:

    "gtm.elementClasses": "firstModal",
    "gtm.elementId": "",
    "gtm.elementTarget": "",
    "gtm.triggers": "6951335_21",
    "event": "gtm.linkClick",
    "gtm.elementUrl": "",
    "eventTimeout": 2000,
    "gtm.uniqueEventId": 3
However this is not being recorded in Analytics under the events tab. Can someone see any possible issues with my configuration? Thank you.
1 Expert replyverified_user
Marked as Best Answer.
Accepted by topic author Stratagem D

Event tracking through GTM not working

Top Contributor
# 2
Top Contributor

Hi, Stratagem D,


Right away I see an error in your trigger setup, but not sure if this is the only thing yet.


You have for your trigger "Click URL matches CSS selector firstModal", however, the Click URL variable returns the value of the href attribute (eg. of the element that was clicked, or empty string if there is no link applicable. In addition,  if you want to use "matches CSS selector", then you must select the "Click Element" variable, and also use proper CSS notation (ie. "matches CSS selector .firstModal" (noticed the dot). You can read more on the "matches CSS selector" here:


Alternatively, instead of using CSS selector matching, you can use "Click Class" since you are clicking on the firstModal class.


Try some of those options and let us know how you fare.



Nicky Yuen, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.
Find me on: Google+ | LinkedIn

Event tracking through GTM not working

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

That makes sense! I do not have the option available for "click element" or "click class" though - are these outdated? 

Event tracking through GTM not working

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

I just located these options under "variables"! Thanks so much.