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

Get GTM trigger to fire on content within a DIV using its ID?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I need to track how often two types of articles are accessed on the start page of a website. One type of articles are easily tracked as their URL all contain the same base hierarchy and are triggerd using a "Click Just Links - Click URL".

The second type of articles URL varies and cannot be tracked as easily so I would like to trigger using the ID of of a DIV. All the examples I have seen so far have done this using the DIVs class, but in my case the class is not unique enough to single it out from other content on the page. So I would like to use the ID instead. The DIV surrounds a list of five articles and I would like a click on any of these to fire the trigger.

I have tried setting it up as:

 GTMproblem.png

 

Click - All Elements

Click elements - Matches CSS selector - #svid93_1098e1ba1519f80c596ca6c0 *

 

The "#svid..." is the DIVs ID.

 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Edward H
April 2017

Get GTM trigger to fire on content within a DIV using its ID?

Top Contributor
# 2
Top Contributor

Hi,

 

Please try:

element - Matches CSS selector - #svid93_1098e1ba1519f80c596ca6c0 a

 

Let me know if it works


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Edward H
April 2017

Get GTM trigger to fire on content within a DIV using its ID?

Top Contributor
# 2
Top Contributor

Hi,

 

Please try:

element - Matches CSS selector - #svid93_1098e1ba1519f80c596ca6c0 a

 

Let me know if it works


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Get GTM trigger to fire on content within a DIV using its ID?

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆

Hi,

 

The problem requires a deeper level of investigation.

unfortunately, your image is not seen clearly.

I would also try element matches css selector option as Arnold mentioned

And check if GTM events are firing in the preview mode and using google dev tools

 

 

 

Get GTM trigger to fire on content within a DIV using its ID?

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Thanks Arnold and Ellaia, I'll get back to you with my results!

Get GTM trigger to fire on content within a DIV using its ID?

Follower ✭ ✭ ☆
# 5
Follower ✭ ✭ ☆

 

Hi Edward,

 

Do have a look at tip number 54, 55 in conjunction with 59

https://www.simoahava.com/analytics/100-google-tag-manager-learnings/

Perhaps it may be of some help

 

 

 

Regards

Ellaiah Pusa

 

 

 

Get GTM trigger to fire on content within a DIV using its ID?

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Good tips, thanks!

The trigger now fires using the anchor or "a" tag. But it only fires once per newly opened tab. So if I:

Open a new tab

Load the starting page containing triggers

Click a link (the event fires and targeted page is shown)

Revisit the starting page and click another link (targeted page is shown but no event is fired)

 

But on opening a new tab and repeating the above the trigger is activated again. So for some reason the event is seen as being unique although I'm in the same session, just in a fresh tab. Is there some setting I'm missing?

Get GTM trigger to fire on content within a DIV using its ID?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭