AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

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

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):

variable.png

 

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

trigger.png

 

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

tag.png

 

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": "https://www.mylinkurl.com/#",
    "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
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Stratagem D
June 2017

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. http://www.example.com) 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: https://www.simoahava.com/analytics/matches-css-selector-operator-in-gtm-triggers/.

 

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

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Stratagem D
June 2017

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. http://www.example.com) 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: https://www.simoahava.com/analytics/matches-css-selector-operator-in-gtm-triggers/.

 

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.