Search code examples
google-tag-manager

Google Tag Manager GTM - Click Element not firing when contains / matches CSS selector


I've read a few posts on here and have understood that for HTML as opposed to string the "matches CSS selector" option should be used however if you take a look at the images you will see I have hit a dead end.

I have an dropdown tool that, depending on where you click it, different elements are clicked. The whole dropdown though has an ID of lamination-type-picker-0 and so regardless of where I click on the dropdown tool, this ID is always present in the "Click Element".

I need to use this fact to trigger a tag but every time I try it it says that the match hasn't been met in the matches CSS selector

Please help - I'm starting to go mad.

Names for tag Values for tag

I've tried virtually all of the options for match types, from "contains" to regex. None seem to hit a match with Click Element.


Solution

  • It looks like a div class to me. So my selector will be

    enter image description here

    div.lamination-type-picker-0, div.lamination-type-picker-0 *

    Because you can see, GTM detects the click on the span element which is in the div.lamination-type-picker-0 we want to track.

    So I add another part with * to match all the element inside the div.lamination-type-picker-0