To retrieve the Visitor
instance, you can utilize Visitor.getInstance()
, and then use
Visitor.getMarketingCloudVisitorID()
to obtain the MC ID (visible in the
mid=
parameter)
For example:
var visitor = Visitor.getInstance("[mcorgid]@AdobeOrg")
s.eVar1 = visitor.getMarketingCloudVisitorID(); // set v2 with mid value
If you have integrated the MC ID service through DTM, you can opt for using _satellite.getVisitorId()
instead of Visitor.getInstance()
, like this:
s.eVar1 = _satellite.getVisitorId().getMarketingCloudVisitorID();
When dealing with your Data Element, switch from a Cookie type to Custom Script type to fetch and return the value, for instance:
try {
return _satellite.getVisitorId().getMarketingCloudVisitorID();
} catch(e) {console.log(e);}
(Update) Alternatives
In response to your comment highlighting the presence of mid=
value in server calls:
On the initial page load without Marketing Cloud cookies, I still observe the MID in the server call.
Since AA captures the mid=
value, consider other indirect methods rather than directly pushing it to eVar.
Dynamic Variables
Employing dynamic variable syntax referencing the mid=
param:
s.eVar1 = "D=mid";
Note: The default D=
is the dynamic variable prefix; ensure configuration/custom code doesn't override it.
Processing Rules
If permitted, establish processing rules to map your eVar to the mid=
value.