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 is supported on Web SDK versions 2.25.0 or later.
This variable requires all of the following:
clickCollectionEnabledmust be enabled.- If you use
clickCollection.filterClickDetails, the deprecated methodonBeforeLinkClickSendmust be empty. - The event payload must contain a value in
xdm.web.webPageDetails.nameat some point in the visitor’s visit.
If your implementation does not meet all of the above requirements, then this object does nothing.
The following properties are available in the clickCollection object:
internalLinkEnabledbooleanhttps://example.com/index.html to https://example.com/product.html would be considered an internal link.downloadLinkEnabledbooleandownloadLinkQualifier property.externalLinkEnabledbooleanhttps://example.com to https://example.net would be considered an external link.eventGroupingEnabledbooleanDetermines if the library waits until the next “page view” event to send link tracking data. The library considers an event a “page view” when the following elements are included in the payload:
xdm.web.webPageDetails.namecontains a string valuexdm.web.webPageDetails.pageViews.valueis greater than0
When the “page view” event loads, the library combines stored link tracking data with the rest of the data in that event. Enabling this option reduces the total number of events that you send to Adobe. If internalLinkEnabled is disabled, then this variable does nothing.
sessionStorageEnabledbooleaninternalLinkEnabled or eventGroupingEnabled are disabled, then this variable does nothing.Adobe strongly recommends enabling this variable when using
eventGroupingEnabled outside of single-page applications. If eventGroupingEnabled is enabled while sessionStorageEnabled 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.filterClickDetailsfunctionIf you don’t set this object in the configure command, then the default settings for this object depend on the value of clickCollectionEnabled:
internalLinkEnabled: MatchesclickCollectionEnableddownloadLinkEnabled: MatchesclickCollectionEnabledexternalLinkEnabled: MatchesclickCollectionEnabledeventGroupingEnabled: 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";
}
}
}
});
Configure click collection for the Web SDK tag extension
These settings can be configured in the Web SDK tag extension using Data collection configuration settings.