Show Menu
TOPICS×

getAnalyticsVisitorID

Returns the legacy Analytics ID (if any) that was stored in the s_vi cookie before the Experience Cloud Identity Service was implemented. It returns an empty string if a visitor was never assigned an Analytics ID.
Syntax
var analyticsID = visitor.getAnalyticsVisitorID()
Typically, this function is used with custom solutions that require reading the visitor ID. It is not used by a standard implementation.
getAnalyticsVisitorID
also works with callback functions to read Analytics IDs and bring them in to your system or application.
Sample Code
//callback function var useAnalyticsVisitorID = function(id){ //whatever your function does with the Experience Cloud ID }; //get Analytics ID and pass it to the function var analyticsID = visitor.getAnalyticsVisitorID(useAnalyticsVisitorID)
If you're an Analytics customer, also check for and send the Analytics ID to your function. For example, you would want both identifiers when passing the visitor ID in a hidden form element to a server-side application that uses the data insertion API. In this case, you should collect and return the Experience Cloud and Analytics visitor IDs. See getMarketingCloudVisitorID .
The "aid" Parameter is a Legacy Value
The
aid
parameter appears in a query string under 2 different sets of conditions.
Case 1
You will see the
aid
parameter in a query string when:
  • The Experience Cloud ID service is deployed correctly.
  • The user visiting a site has a pre-existing Analytics ID stored in their s_vi cookie .
Case 2
You will see the
aid
parameter in a query string when your organization is using a grace period before fully implementing the ID service. If the user visiting your site is new, and you're not using a grace period, the visitor will get the
mid
( Experience Cloud ID) parameter.