Expand my Community achievements bar.

SOLVED

Retrieving getMarketingCloudVisitorID with and without callback

Avatar

Level 1

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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