Automatic link tracking logic
The Web SDK tracks all clicks on <a>
and <area>
HTML elements if it doesn’t have an onClick
attribute. Clicks are captured with a capture click event listener that is attached to the document. When a valid link is clicked, the following logic is run in order:
- If the link matches criteria based on values in
downloadLinkQualifier
, or if the link contains adownload
HTML attribute,xdm.web.webInteraction.type
is set to"download"
(ifclickCollection.downloadLinkEnabled
is enabled). - If the link target domain differs from the current
window.location.hostname
,xdm.web.webInteraction.type
is set to"exit"
(ifclickCollection.exitLinkEnabled
is enabled). - If the link doesn’t qualify for either
"download"
or"exit"
,xdm.web.webInteraction.type
is set to"other"
.
In all cases, xdm.web.webInteraction.name
is set to the link text label and xdm.web.webInteraction.URL
is set to the link destination URL. If you want to set the link name to the URL as well, you can override this XDM field using the filterClickDetails
callback in the clickCollection
object.
Enable automatic link tracking using the Web SDK tag extension
This variable is automatically managed by the tag extension; you do not need to explicitly set it. If any of the following are selected when configuring the tag extension, the applicable link tracking data is collected:
- Collect internal link clicks
- Collect external link clicks
- Collect download link clicks
See clickCollection
for more information.