You are here: Tags / css selectors
Some four years ago, Google Tag Manager released a new trigger predicate named matches CSS selector. Slowly but surely, it has evolved into one of the most useful little features in GTM. Even though I’ve written about CSS selectors many times before, I wanted to compile all the relevant information into a single guide. For an external resource, I recommend bookmarking the CSS Selector Reference. But for your day-to-day use of CSS selectors in GTM, this guide will hopefully prove useful.

Continue reading

When using the All Elements trigger in Google Tag Manager, it’s easy to overlook the fact that it captures all clicks on the page. It’s also brutally accurate - it captures clicks on the exact element that was below the mouse button when a click happened. This means that when working with the All Elements trigger, you need to be more careful when identifying the correct element you actually want to track clicks on.

Continue reading

Without a doubt, the possibility to leverage CSS selectors in Google Tag Manager’s trigger conditions is one of the most useful features of the platform. It gives you an amazing amount of flexibility, especially when combined with GTM’s click and form triggers. Essentially, CSS selectors let you test an HTML Element against a selector string. This check verifies that the element matches the given selector. In practice, this would mean that when you use the click or form trigger, you can check if the Click Element or Form Element built-in variables match a specific selector, allowing you to confirm that the action happened on the correct element.

Continue reading

Author's picture

Simo Ahava

Husband | Father | Analytics developer
simo (at)

Senior Data Advocate at Reaktor