Expand my Community achievements bar.

Cross Domain tracking when user have multiple redirections

Avatar

Level 6

Hi Team,

 

Recently I have faced a issue regarding cross domain tracking when user click on login which is added as button without anchor tag href.

Amruthesh_AG_1-1739881264974.png

 

 

I have implemented appendVisitorIDsTo method and it will works fine when you link is having href but when user click on button which will not have anchor tag and href in this case Implement a robust cross-domain tracking solution using Adobe Analytics (AppMeasurement.js) where tracking parameters are appended to button URLs through the backend system.

This ensures consistent visitor identification across multiple domains.

 

I have worked with back-end developer and added the AppMeasurement.js and VisitorAPI.js script on head section so that when user click on button it will appendVisitorID and set it on next redirection URL so that when user lands on page it will add the visitors id in landing page and visitor it will not get changed.

With this solution visitor identity is maintained seamlessly across domains, improving attribution accuracy and enhancing cross-domain reporting in Adobe Analytics.

 

Attached the used scripts as a file for reference.

Append Visitor ID Code Sample

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');
});
});
}
});

0 Replies