ÃÛ¶¹ÊÓƵ

linkTrackEvents

Some implementations don’t want to include all variables in all link tracking image requests. Use the linkTrackVars and linkTrackEvents variables to selectively include dimensions and metrics in tl() calls.

This variable is not used for page view calls (t() method).

Determine which Analytics events to include in an XDM event using the Web SDK

The Web SDK does not exclude certain fields for link tracking calls. However, you can use the onBeforeEventSend callback to clear or set desired fields before data is sent to ÃÛ¶¹ÊÓƵ. See Modifying events globally in the Web SDK documentation for more information.

ÃÛ¶¹ÊÓƵ Experience Platform automatically includes defined events in link tracking hits if you do not use custom code.

IMPORTANT
If you set events in Analytics extension’s custom code editor, you must include the event in linkTrackEvents using custom code as well.

s.linkTrackEvents in AppMeasurement and the Analytics extension custom code editor

The s.linkTrackEvents variable is a string containing a comma-delimited list of events that you want to include in link tracking image requests (tl() method). The following three criteria must be met to include metrics in link tracking hits:

  • Set the desired event in the events variable. For example, s.events = "event1";.
  • Set the events variable in linkTrackVars. For example, s.linkTrackVars = "events";.
  • Set the desired event in the linkTrackEvents variable. For example, s.linkTrackEvents = "event1";.
s.linkTrackEvents = "event1,event2,event3,purchase";

The default value for this variable is an empty string. If this variable is not defined, all events are included in link tracking image requests. Note that Data Collection automatically populates this variable based on events set in the interface, so it is always set for implementations that use tags in ÃÛ¶¹ÊÓƵ Experience Platform.

TIP
Avoid using the Analytics object identifier (s.) when specifying events in this variable. For example, s.linkTrackEvents = "event1"; is correct, while s.linkTrackEvents = "s.event1"; is incorrect.

Example

The following link tracking function includes only event1 (not event2) in the image request sent to ÃÛ¶¹ÊÓƵ:

s.events = "event1,event2";
s.linkTrackVars = "events";
s.linkTrackEvents = "event1";
s.tl(this,"o","Example Custom Link");
recommendation-more-help
b4f6d761-4a8b-4322-b801-c85b9e3be690