Append Visitor ID Code Sample
The following example code can help you get started with the appendVisitorIDsTo
function:
This code can be placed in the Custom Code editor that’s part of the Adobe Analytics extension or at the top of AppMeasurement.js.
var adbeDomains = ["marketo.com", "figma.com", "workfront.com"];
var visitor = Visitor.getInstance("9E1005A551ED61CA0A490D45@AdobeOrg", {
trackingServer: "sstats.adobe.com",
trackingServerSecure: "sstats.adobe.com",
marketingCloudServer: "sstats.adobe.com",
marketingCloudServerSecure: "sstats.adobe.com"
});
adbeDomains.forEach(function(domain) {
var domainRegex = RegExp(domain);
if (!domainRegex.test(location.hostname)) {
hrefSelector = '[href*="' + domain + '"]';
document.querySelectorAll(hrefSelector).forEach(function(href) {
href.addEventListener('mousedown', function(event) {
var destinationURLWithVisitorIDs = visitor.appendVisitorIDsTo(event.currentTarget.href)
event.currentTarget.href = destinationURLWithVisitorIDs.replace(/MCAID%3D.*%7CMCORGID/, 'MCAID%3D%7CMCORGID');
});
});
}
});
Previous pageappendSupplementalDataIDTo
Next pagecallTimeOut Methods
Experience Cloud Services
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more