getVisitorValues getvisitorvalues

This is an asynchronous API that returns identifiers for Analytics, the ID service, data collection opt-out, geographic location, and metadata “blob” content by default. Also, you can control which IDs you want to return with the optional visitor.FIELDS enum.

Contents:

Syntax section-5aebe3907b2b46e997f45a1d1ed35c09

This function uses the following syntax (italics represents a placeholder for a variable): var *values* = visitor.getVisitorValues (callback, [visitor.FIELDS. *ID type*, visitor.FIELDS. *ID type*]);

In the function parameters:

  • *callback* represents your own callback code that receives the returned IDs.
  • (Optional) visitor.FIELDS. *ID type* is an enum that lets you specify which ID values you want this function to return.

See the following use cases and definitions for more information.

Use Case 1: Request the Default Data Set section-36a31683558742a5915db3a391e09f7b

This code returns the standard data set. Your request and response could look similar to the following examples.

//Call the ID service
var visitor = Visitor.getInstance ("Insert Experience Cloud organization ID here",{...});

//Add your callback to the GET method to return IDs and data.
visitor.getVisitorValues(visitorIdsCallback);

In the default sample response, some values have been shortened for demonstration purposes.

//Formatted IDs in JSON response
{
    MCMID: 'mid-1234',
    MCOPTOUT: 'isoptedout-true',
    MCAID: 'aid-1234',
    MCAAMLH: 7,
    MCAAMB: 'hgfe54236786oygj'
}

Use Case 2: Request a Custom Data Set section-467b2f4e513344c89b7332b05f6f59f3

This code uses an optional array to return a specific set of IDs using the visitor.FIELDS enum. In this case, we only want the visitor’s Experience Cloud ID (MCID) and Analytics ID (MCAID). Your request and response could look similar to the following examples.

//Call the ID service
var visitor = Visitor.getInstance("Insert Experience Cloud organization ID here", { ... });

// Add an optional array to specify which IDs you want to return.
visitor.getVisitorValues(visitorIdsCallback, [visitor.FIELDS.MCMID, visitor.FIELDS.MCAID]);

The customized sample response returns only those IDs specified in the request.

//Formatted IDs in JSON response
{
    MCMID: 'mid-1234',
    MCAID: 'aid-4321'
}

Response Parameters Defined section-4c4c300167694c6fbff1d6c612f372b5

The following table lists and defines the response parameters. These are also all the values in the visitor.FIELDS enum. Note, this method returns and empty string if there are no values for a particular variable.

Value
Description
MCAAMB
Encrypted Audience Manager metadata known as "the blob."
MCAAMLH

The data collection region ID. This is a numeric identifier for the geographic location of a particular ID service data center.

See DCS Region IDs, Locations, and Host Namesand getLocationHint.

MCAID
The visitor's Analytics ID.
MCMID

The visitor's Experience Cloud ID.

See Cookies and the Experience Cloud Identity Service.

MCOPTOUT

A flag that indicates if a visitor has opted out of data collection.

Values include:

  • 'isoptedout-true' : A visitor has opted out of data collection.
  • 'isoptedout-false' : A visitor has not opted out of data collection.
recommendation-more-help
9c9e8ca9-9f7e-42c9-a5d5-a0d82776362a