clickCollection
The clickCollection
object contains several variables that help you control automatically collected link data. Use these variables when you want to include or exclude types of links from data collection.
It requires clickCollectionEnabled
to be enabled.
It is supported on Web SDK 2.25.0 or later.
The following variables are available in the clickCollection
object:
-
clickCollection.internalLinkEnabled
: A boolean that determines if links within the current domain are automatically tracked. For example,https://example.com/index.html
tohttps://example.com/product.html
. -
clickCollection.downloadLinkEnabled
: A boolean that determines if the library tracks links that qualify as downloads based on thedownloadLinkQualifier
property. -
clickCollection.externalLinkEnabled
: A boolean that determines if links to external domains are automatically tracked. For example,https://example.com
tohttps://example.net
. -
clickCollection.eventGroupingEnabled
: A boolean that determines if the library waits until the next page to send link tracking data. When the next page loads, combine the link tracking data with the page load event. Enabling this option reduces the number of events that you send to Adobe. IfinternalLinkEnabled
is disabled, then this variable does nothing. -
clickCollection.sessionStorageEnabled
: A boolean that determines if link tracking data is stored in session storage instead of local variables. IfinternalLinkEnabled
oreventGroupingEnabled
are disabled, then this variable does nothing.Adobe strongly recommends enabling this variable when using
eventGroupingEnabled
outside of single-page applications. IfeventGroupingEnabled
is enabled whilesessionStorageEnabled
is disabled, clicking to a new page results in loss of link tracking data, as it is not preserved in session storage. Since single-page applications don’t typically navigate to a new page, session storage is not required for SPA pages. -
filterClickDetails
: A callback function that provides full controls over link tracking data that you collect. You can use this callback function to alter, obfuscate, or abort sending link tracking data. This callback is useful when you want to omit specific information, such as personally identifiable information within links.
Click collection settings using the Web SDK tag extension
Select any of the following options when configuring the tag extension:
-
Collect internal links
-
Event grouping options:
- No event grouping
- Event grouping using session storage
- Event grouping using local object
-
-
Collect external links
-
Collect download links
-
Filter click properties
- Log in to experience.adobe.com using your Adobe ID credentials.
- Navigate to Data Collection > Tags.
- Select the desired tag property.
- Navigate to Extensions, then click Configure on the Adobe Experience Platform Web SDK card.
- Scroll down to the Data Collection section, then select the desired click collection settings.
- Click Save, then publish your changes.
The Filter click properties callback opens a custom code editor that lets you insert the desired code. Within the code editor, you have access to the following variables:
content.clickedElement
: The DOM element that was clicked.content.pageName
: The page name when the click happened.content.linkName
: The name of the clicked link.content.linkRegion
: The region of the clicked link.content.linkType
: The type of link (exit, download, or other).content.linkURL
: The destination URL of the clicked link.return true
: Immediately exit the callback with the current variable values.return false
: Immediately exit the callback and abort collecting data.
Any variables defined outside of content
can be used, but are not included in the payload sent to Adobe.
Click collection settings using the Web SDK JavaScript library
Set the desired variables within the clickCollection
object when running the configure
command. If not set, default settings for this object depend on the value of clickCollectionEnabled
.
internalLinkEnabled
: MatchesclickCollectionEnabled
downloadLinkEnabled
: MatchesclickCollectionEnabled
externalLinkEnabled
: MatchesclickCollectionEnabled
eventGroupingEnabled
: Defaults tofalse
; must be explicitly enabledsessionStorageEnabled
: Defaults tofalse
; must be explicitly enabledfilterClickDetails
: Does not contain a function; must be explicitly registered
eventGroupingEnabled
when internalLinkEnabled
is enabled, as it reduces the number of events that count toward contractual usage.alloy("configure", {
datastreamId: "ebebf826-a01f-4458-8cec-ef61de241c93",
orgId: "ADB3LETTERSANDNUMBERS@AdobeOrg",
clickCollectionEnabled: true,
clickCollection: {
internalLinkEnabled: true,
downloadLinkEnabled: true,
externalLinkEnabled: true,
eventGroupingEnabled: true,
sessionStorageEnabled: true,
filterClickDetails: function(content) {
// If the link is a clickable telephone number, anonymize it
if(content.linkUrl?.includes("tel:")) {
content.linkName = content.linkUrl = "Phone number";
}
// If the link is an email address, anonymize it
if(content.linkUrl?.includes("mailto:")) {
content.linkName = content.linkUrl = "Email address";
}
}
}
});