In certain scenarios, you may want to set up a trigger to activate whenever someone clicks on an element or any of its nested child elements.

For instance, if your HTML structure resembles the following and you establish a trigger for any element with the class="myClass", it will only register clicks on the “Main DIV” and not on the child1 and child2 elements:

<div class="myClass">
Main DIV
  <span class="child1">Child 1</span>
  <span class="child2">Child 2</span>
</div>

To ensure that all elements within class="myClass" trigger the desired action, you can create a trigger where “Click Classes matches the CSS selector .myClass *“.

Note: The asterisk (*) in a CSS selector is a wildcard that matches any element. By using the selector .myClass *, which combines the class selector .myClass with the wildcard, the trigger will fire when any element with the class myClass or any of its descendant elements are clicked.

Previous FAQ: How do I stop GTM dataLayer values from overriding MTM dataLayer values?