How to track clicks that contains specific Attributes in GTM

Sometimes you want to track clicks that have no click class or click id. Therefore you try to move up or down of DOM using custom HTML tag in GTM. You can also use Click All Elements matches CSS selector in GTM to Target those clicks using other attributes like alt text, href or any other attribute along with any attribute from the ancestors to track clicks.

Matches CSS Selector can be used with any click or form submission to easily track by moving up or down of DOM. If you wish to track any element or link clicks that contains a specific attribute like href or alt, you can use matches css selector to easily track click on them.


Simply create a trigger which fires when Click-Element matches that alt. You can also take any other unique element as well from above levels of DOM so that it does not fires on all other elements that contain the same attribute.

trigger configuration GTM