Enable cross-domain visitor profiles

The Platform Web SDK supports visitor ID sharing capabilities that enable customers to deliver personalized experiences more accurately across your domains. This capability allows you to deliver consistent personalization across domains and enhances the accuracy of your visitor activity reporting, without relying on third-party cookies.

Prerequisites

To use cross-domain ID sharing, you must use Platform Web SDK version 2.11.0 or later. This capability is also compatible with VisitorAPI.js version 1.7.0 or later.

Cross-domain ID sharing works by appending a special adobe_mc query string parameter to the URL of the destination domain. This parameter is used for specifying the visitor ID instead of generating a new ID or using an existing ID.

The destination domain must use either of these libraries for cross-domain ID sharing to process the adobe_mc parameter and share the visitor ID properly.

Approach comparison

Before implementing, first determine if your existing implementation uses the visitor.appendVisitorIDsTo() function. Any custom code using this function should be updated to use the new appendIdentityToUrl Web SDK command.

VisitorAPI.js
Platform Web SDK
visitor.appendVisitorIDsTo(*url*)
alloy("appendIdentityToUrl", { url: *url* })

Using the appendIdentityToURL command

For cross-domain ID sharing, Web SDK version 2.11.0 adds support for the appendIdentityToUrl command. When used, this command generates the adobe_mc query string parameter.

The command accepts an object with one property, url, and returns an object with the property url.

This command does not wait for any consent update. If consent has not been provided, the URL is returned unchanged.

If an ECID is not provided, the /acquire endpoint is called to generate an ECID.

Below is an example of how you can implement cross-domain ID sharing.

This code adds an event listener for all the clicks on the page. If the click was on a link to a matching domain, in this case adobe.com or behance.com, it adds the identity to the URL and redirects the user there.

document.addEventListener("click", event => {
  const anchor = event.target.closest("a");
  if (!anchor || !anchor.href) {
    return;
  }
  const url = new URL(anchor.href);
  if (!url.hostname.endsWith("adobe.com") && !url.hostname.endsWith("behance.com")) {
    return;
  }
  event.preventDefault();
  alloy("appendIdentityToUrl", { url: anchor.href }).then(result => {
    document.location = result.url;
  });
});
TIP
When using the tags feature (formerly Launch) to implement Web SDK, cross-domain ID sharing can be accomplished without custom code. Refer to the dedicated documentation for more details.
NOTE
The Platform Web SDK also supports mobile-to-web ID sharing for native mobile app use cases. For more information, refer to the dedicated documentation about mobile-to-web and cross-domain ID sharing.

Next, learn how to update audiences and profile scripts to ensure compatibility with Platform Web SDK.

NOTE
We are committed to helping you be successful with your Target migration from at.js to Web SDK. If you run into obstacles with your migration or feel like there is critical information missing in this guide, please let us know by posting in this Community discussion.
recommendation-more-help
a69e1b51-9545-4d8a-822d-319242c29110