getMarketingCloudVisitorID getmarketingcloudvisitorid

getMarketingCloudVisitorID returns the ECID.

Syntax: var *variable name* = visitor.getMarketingCloudVisitorID()

This method typically used with custom solutions that require reading the visitor ID. It is not used by a standard implementation. getMarketingCloudVisitorID also works with callback functions to read Analytics IDs and bring them in to your system or application.

//callback function
var useMarketingCloudID = function(id){
     //whatever your function does with the ECID
};

//get the ECID and pass it to the function
var mcID = visitor.getMarketingCloudVisitorID(useMarketingCloudID)
TIP
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 ECID and Analytics visitor IDs. See Get Analytics Visitor ID.
recommendation-more-help
id-service-help