DTM Examples- Simple s.tl beacon Event-Based Rule

Basic Click

Event-Based Rules are often used to fire an s.tl() (non-page view) Analytics beacon when the user clicks an element on the page, such as a link that takes the user to a partner site.

The above link has the following code:

<a href="http://www.adobe.com" class="partnerExit">This is an example link.</a>

I could configure DTM to listen to this click by setting up my rule to listen for any click to a link (an "a" tag) with a class of "partnerExit":

Referencing "this"

Event-based rules can reference the object the rule fired on by using "this". For many things, this can be used directly in the interface:

Or, for more advanced needs, in the custom code (like this jQuery example) :

Link Track Vars

DTM will automatically take variables set in the interface and set the appropriate s.linkTrackVars and s.linkTrackEvents. However, if you are setting any variables within your custom code, DTM won't know to append those to s.linkTrackVars and s.linkTrackEvents so that Adobe will be sure to include those variables in the beacon.

So if you are setting any variables in an s.tl rule in DTM, you need to make sure it gets added to the s.linkTrackVars and s.linkTrackEvents variables: