Triggers are the conditions that cause tags to fire. A basic example of a trigger is a click on any HTML element of type button.
You may also create triggers based on CSS selectors:
Track clicks on elements with the class btn
Track clicks on elements with the class btn , and elements with class .btn-large
Track clicks on elements with both btnand btn-largeclasses
Tracks all buttons with the type attribute set to submit
We don't have strict standards around triggers at this time, though we can provide some guidelines on creating them.
Be careful about which selectors you use for triggers. If a class is applied liberally to your markup, Tag Manager will pick up clicks to all of them.
If URLs change frequently, you may wish to avoid tying a trigger to a page by URL. If you can push a unique identifier into the dataLayer, your triggers will be less likely to break.
If markup changes frequently, you may wish to ask developers to add a persistent ID you can hook into for key elements
The difference between the "All elements" and "All links" trigger is that the latter will walk up the DOM to look for the nearest a element, while the latter will focus only on elements that contain exactly the selector you assigned