GTM Click Element does not fire on click - google-tag-manager

I want to fire a GTM trigger based on the div the button is in.
The Tag Details show the Click Element condition is not met:
But the Variables on the exact same Click show the Click Element does contain 'div.website-notice':
I cannot figure it out. Please help :)

Updated GTM Debug output is misleading. Click Element value is HTMLElement not a string so you have to use matches CSS selector condition instead of contains in your trigger.

You can use "match css selector" as contain.
The click element seems not working the same way as other built-in variables.

Related

gtm elements and classes are - GA/GTM

I have accordions in my website and I am using GTM to track Clicks using GTM triggers. Below is the inspect screenshot of the accordion:
And my GTM settings to track click based on the class name is as below:
The problem is, on the preview mode, clicks are detected but the element and classes are empty as below:
The gtm.elementclasses, gtm.elementid are all empty. How can I fix this?
I think it is because the GTM detecting the click target is the h3 dom in the div you want right?
I would suggest to change the trigger to
Click Element -> match css selector -> "div.key-activity__grouping, div.key-activity__grouping *"
This will capture all the click event inside the div.
Does this meet your requirement?

Google Tag Manager: trigger click on div ID with other elements inside

I have created a couple of click triggers in Google Tag Manager to track some areas of my site and I was surprised that the figures were so low. I have realised why but couldn't find a way around it.
Code example:
<li id="myUniqueID"><i class="material-icon">mail_outline</i></li>
If I create a click trigger on "myUniqueID", it only captures the clicks in the area outside the space occupied by the icon. If I click right into the icon, the listener is not fired.
Is there a way to capture all clicks based on a unique ID or class that would take clicks of all sub-elements into account.
It's probably something stupid that I have overlooked.
Thanks!
Change your trigger to Click All Elements that Match a CSS Selector.
As a selector, try using #myUniqueID, #myUniqueID *
The second selector selects all descendants/children of whoever has the myUniqueID id.

GTM: Click Element Trigger not firing

I can't understand why my triger is not firing.
Does anyone know how to fix it?
I have couple elements on pages that contains span.sharing__icon in Click Element so I want to use single trigger for all of them.
Here's the screen on my setup in GTM:
Thanks to everyone in advance.
Elements don't "start with".
Elements match css selectors.
Change your condition to be a match rather than starts with.
Try giving the click element a class ID in the source code, and use the condition for Click Classes that equals that Class name you assigned for that click element.
In that case, as mentioned use matches CSS selector and you can click on copy selector when using inspect element. (Make sure to copy the selector on the URL element)

GTM - is it possible to disregard an event click on a trigger if element clicked twice and limit amount of clicks on an element

A scenario has risen where I am trying to track button clicks. (There are several on the page as they are toggable filters).
Each button has a class relevant to it IE .filter .Dogs , .filter .Cats
When someone toggles a filter, the button's parent element gains the class "selected". I tried to track this, using the match css selector option of .selected>.filter
Unfortunately GTM doesnt seem to detect the "selected" class appearing, so I thought would it be possible to disregard the event click if the element was clicked twice and also limit the amount that the element could be clicked.
Thank you

Codeception, WebDriver | How to hover, then click at a hovered location

I am using WebDriver and Asserts as modules in my acceptance testing.
Using WebDriver, I am trying to click on a label that acts as the javascript anchor for a form checkbox (the actual checkbox being hidden and a ::before font element being used to represent the checkbox as checked or not).
There is a link in this label which is located at the center of the element; the position I assume is targeted by the click() method. Due to this, I can't just click() on the element, as it will click the link instead of triggering the checkbox.
I envisioned that the solution for this problem would be to moveMouseOver(), using coordinates arguments in order to displace it to the side, then to trigger a click... but click() does not allow for a click event at the current cursor location, instead requiring a selector to be applied, thus defeating my purpose.
Is there any way to accomplish what I am attempting in the current WebDriver module in Codeception? Alternately, is there a way to accomplish this targeting of an uneven element for clicking without the process I've outlined?
Thank you for whatever help you are able to give.
I use a workaround: just making element visible via JavaScript:
$I->executeJS("$('css_selector').css({'display':'block'});");

Resources