Expand my Community achievements bar.

SOLVED

AEP - Marketing Cloud Visitor ID question

Avatar

Level 4

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 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

 

Cheers from Switzerland!


View solution in original post

9 Replies

Avatar

Correct answer by
Community Advisor

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

 

Cheers from Switzerland!


Avatar

Level 4

@bjoern__koth 

In our custom AA custom implementation there was a need to wipe and reconstruct the s object before the adobe call was made. Now, in case of the web sdk we don't have such a necessity.

Question - can we rely on the web sdk base code to set the marketing cloud ID ? Can you foresee any issues with this approach ?

Avatar

Community Advisor

Hi @Franc_G 

the marketing cloud id being the ECID is automatically set from the WebSDK.

 

If you have the need to assign it to a prop or eVar, I would recommend using datastream mapping. Implemented it for a different client and it works super.

https://experienceleague.adobe.com/en/docs/experience-platform/tags/extensions/client/web-sdk/access...

 

bjoern__koth_0-1719857890472.png

 

Cheers from Switzerland!


Avatar

Level 4

@bjoern__koth  thanks for the above. We have a situation where a visitor moves from mobile app to web and we need to reset the ECID with MID obtained from the mobile app OR stitch those two together to indicate that it is the same user moving from app to web. What would be best way to do it ? I have looked at the identitymap. But unsure whether I need to include the 

xdm.identityMap

 

on each analytics call when MID is available (we pass / handover) the MID via query string parameter.

Avatar

Community Advisor

Hi @Franc_G 

maybe this helps:

 

Cheers from Switzerland!


Avatar

Level 4

@bjoern__koth So, based on the above, I don't need to set up anything in the ?

xdm.identityMap

Thank you.

Avatar

Community Advisor

Well I would give it a try and see whether the information gets picked up in your requests 

Cheers from Switzerland!


Avatar

Level 4

@bjoern__koth I have tried to mock the request by adding the "adobe_mc" qp parameter, but nothing is being picked up automatically. Below is the url I am have generated:

 https://sit.fil.co.uk/bereavement-notification/?adobe_mc=test&ECID=123456&MCID=87878787878787&MCORGI...

 

Can't see the 

xdm.identityMap

in any of the request. Generated the URL based on the doc provided. 

Avatar

Community Advisor

Hi @Franc_G 

this is a working sample URL from one of my clients.

 

https://www.someclient.ch/de/index.html?adobe_mc=TS%3D1720162921%7CMCMID%3D4529836067192262621031948...

 

on the receiving end, if I execute the alloy getIdentity call

 

 

 

alloy("getIdentity")
  .then(function(result) {
      if (result?.identity?.ECID) alert(result.identity.ECID);
  })
  .catch(function(error) {
    console.error("something went wrong", error)
  });

 

 

 

 

bjoern__koth_0-1720163359957.png

 

Note that we're using a different use case, we're using the Web SDK "Redirect with identity" action to append the identifiers on link clicks between known domains.

But the basic logic behind it is the same, hence the identityMap is also populated with the ECID.

bjoern__koth_2-1720163705854.png

 

 

 

Cheers from Switzerland!