Hi @Shashi15
may I ask first how you are intending to use it? Do you want to send it to for instance Adobe Analytics or do you want to use it in other non-Adobe tools?
You can find the documentation here
Basically, you have two options
1. Using a Launch Data Element
- this is a little tricky since alloy calls are asynchronous, so there is a chance that this call has not been finished if you are trying to evaluate it on the fly
- typically, you will want to execute this as early as possible i.e., when the Launch library loads. Also, to not have to make this call every single time, it's recommended to persist this value in e.g., sessionStorage or a cookie and only make the call when it's not set. This will also improve the async problem a little
alloy("getIdentity")
.then((result) => result?.identity?.ECID)
.catch((error) => {
// The command failed.
// "error" will be an error object with additional information.
_satellite.logger.error(">>> alloy ecid error", error);
});
2. Using datastream mapping via Data Prep (recommended)
- every call from the Web SDK into the Experience Platform automatically contains the ECID value
- if you want to map the ECID to a prop or eVar in Adobe Analytics, you can simply set up the mapping in the datastream. Note that the prefix "_experience.analytics.customDimensions" will make sure that anything below is properly mapped into AA
Cheers from Switzerland!