Expand my Community achievements bar.

AEP - Marketing Cloud Visitor ID question

Avatar

Level 2

Hi all, I have a tag in our custom implementation, which sets the marketing cloud id . Can someone explain me what happens in case of marketing cloud ids in case of web sd. Thanks

 

Custom code from the tag is provided below. 

 

var sendAdobePageViewCall = function () {
  setTimeout(
    function () {
      if (
        typeof window.AdCloudEvent === "function" &&
        typeof this.exec === "function" &&
        this.pre &&
        this.pre.length
      ) {
        try {
          // Forces use of SSL in all cases
          window.AppMeasurement.getInstance(window.s.account).ssl = true;
          // Persists MID using 'mid' query parameter, cookie or localStorage
          var mid =
            location.href.match(/mid=([^&\?]+)/i) ||
            Bootstrapper.Cookies.get("aa_mid") ||
            window.localStorage.getItem("ens_mid") ||
            window.localStorage.getItem("marketingCloudVisitorId");
          if (mid && mid.length) {
            var forcedMid = Array.isArray(mid) ? mid[1] : mid;
            window.visitor.setMarketingCloudVisitorID(forcedMid);
          }
        } catch (e) {}
        Bootstrapper.AF.push(["call", "s", "exec"]);
        Bootstrapper.FILSPA.initialAdobePageViewFired = true;
        setTimeout(window.s.resetCustomActivityMap, 500);
      } else Bootstrapper.AF.push(["call", "s", "safelyExec"]);
    }.bind(this),
    250
  );
};
Bootstrapper.AF.push(["set", "s", "safelyExec", sendAdobePageViewCall]);

/*
    Triggers the Adobe page view for flat sites *and* SPAs
  */
Bootstrapper.AF.push(["call", "s", "safelyExec"]);

1 Reply

Avatar

Level 8

This should be possible using the identityMap in the XDM, providing your custom id as separate namespace.

Afterwards, you can set up the datastream's Analytics configuration to use this separate namespace for the Adobe Analytics VisitorID.

 

see also

 

https://experienceleague.adobe.com/en/docs/experience-platform/xdm/field-groups/profile/identitymap

https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/config-vars/visitorid

https://experienceleague.adobe.com/en/docs/experience-platform/datastreams/configure