Retrieving getMarketingCloudVisitorID with and without callback | Community
Skip to main content
August 15, 2022
Solved

Retrieving getMarketingCloudVisitorID with and without callback

  • August 15, 2022
  • 1 reply
  • 1107 views

Hi All,
I am trying to retrieve the mcid using visitor api, I just want to understand a couple of things.

1) When the getMarketingCloudVisitorID method uses a callback(var mcid = s.visitor.getMarketingCloudVisitorID(cb)) to return the mcid compared to not passing the callback(var mcid = s.visitor.getMarketingCloudVisitorID()).
Reason for asking is,  s.visitor.getMarketingCloudVisitorID() without callback returns mcid most of the times when I am not clearing my cookie and cache before loading the page.

2) Is there any chance the mcid generated in the user machine matches with any previous mcid(returning user), in case the user clears the cookie and cache in the second visit.

Thanks
Shinov

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by yuhuisg

Since this is under the DTM community (which should really be renamed to the "AEP Tags" community now), I'll assume that you're using Adobe's tag manager for your tracking needs.

1. I normally just use _satellite.getVisitorId().getMarketingCloudVisitorID(). I find that the callback is not needed for most cases. The callback method is provided because ECID needs to send a request to Adobe's endpoint, then wait for the response with the generated ID. So the callback allows for any execution that needs to run after the ID has been retrieved. But like I said, most of the time when the ID is needed, it would have been generated and saved to a cookie already, since ECID is one of the first things that runs on the page.

2. Yes, but this depends on the user having a 3rd-party cookie from demdex.net. See https://experienceleague.adobe.com/docs/id-service/using/intro/id-request.html?lang=en

1 reply

yuhuisg
Community Advisor
yuhuisgCommunity AdvisorAccepted solution
Community Advisor
August 16, 2022

Since this is under the DTM community (which should really be renamed to the "AEP Tags" community now), I'll assume that you're using Adobe's tag manager for your tracking needs.

1. I normally just use _satellite.getVisitorId().getMarketingCloudVisitorID(). I find that the callback is not needed for most cases. The callback method is provided because ECID needs to send a request to Adobe's endpoint, then wait for the response with the generated ID. So the callback allows for any execution that needs to run after the ID has been retrieved. But like I said, most of the time when the ID is needed, it would have been generated and saved to a cookie already, since ECID is one of the first things that runs on the page.

2. Yes, but this depends on the user having a 3rd-party cookie from demdex.net. See https://experienceleague.adobe.com/docs/id-service/using/intro/id-request.html?lang=en

shinovAuthor
August 16, 2022

Thanks @yuhuisg