Get User IDs and Regions Through the Adobe Experience Platform Identity Service get-user-ids-and-regions-through-the-experience-cloud-id-service

ID service customers should refer to this section for information on how to read the visitor cookie for the IDs required to make DCS API calls.

The Adobe Experience Platform Identity Service assigns visitor and region IDs to users who come to your website. These IDs identify users across all the solutions in the Experience Cloud and they are required if you want to make DCS calls.

  • The user ID is required to identify and associate data with a particular visitor.
  • The region ID is required because it is tied to a regional server name, which you need to send data to the DCS. The DCS stores information in data centers that are geographically closest to site visitors. See DCS Region IDs, Locations, and Host Names.

ID service customers can extract this information from the ID service cookie or by calling a function. The table below describes the tasks or steps you need to complete to get started.

Code in italics represents a variable placeholder.

Task
Description
1. Check your Experience Cloud status

You need a Experience Cloud account to use the ID service. If you have a Experience Cloud account, great!

If you're not part of the Experience Cloud, then sign up. We'd love to have you and there's always room for more. For instructions on how to set up an account, see Enabling Your solutions for core services.

2. Set up the ID service
The ID service consists of JavaScript code that gets put on each page you want to use for data collection. See the ID service implementation guides for more information.
3. Read the ID service cookie

The ID service stores the user and region ID in the AMCV cookie. The full cookie name is AMCV_###@AdobeOrg. The ### elements are placeholders for your organization ID. See Cookies and the Experience Cloud ID for details.

Parse the AMCV cookie for these key-value pairs:

  • mid=user ID: This key-value pair holds the Experience Cloud user ID.
  • aamlh=region ID: This key-value pair holds the region ID (sometimes called a location hint) which is associated with a regional server name.

You can make calls to the DCS once you have the user and region IDs.

4. Retrieve the Experience Cloud ID with getMarketingCloudVisitorID

(Optional) This function returns the Experience Cloud visitor ID. It is designed for custom solutions and specific use cases. See Working With getMarketingCloudVisitorID below and the related ID service documentation.

You don't need to use this if you get the user and location IDs from the ID service cookie.

Working With getMarketingCloudVisitorID working-with-getmarketingcloudvisitorid

Another way to get the visitor ID is with the getMarketingCloudVisitorID function. When invoked, this function queries the ID service and returns an ID. getMarketingCloudVisitorID accepts the optional callback argument as shown:

var analyticsID = visitor.getAnalyticsVisitorID(callback)

Callback Usage and Purpose callback-usage

callback is optional. This function works without it, but returns an ID only when a visitor has a Experience Cloud cookie in their browser. If the visitor cookie is missing, or a visitor doesn’t have an ID, the function returns an empty () object. This can happen even after the page loads and the visitor receives a new ID. To avoid this, callback forces this function to check for a visitor ID after the page loads. Without callback, the visitor ID function won’t return an ID even if it’s written to the visitor’s browser later.

Next Steps next-steps

Once you have the user and region ID, you can start sending and receiving DCS data. See Making DCS API Calls.

recommendation-more-help
de293fbf-b489-49b0-8daa-51ed303af695