The Experience Cloud Identity (ECID) is a persistent identifier assigned to a user when they visit your website. In certain circumstances, you might prefer to access the ECID (to send it to a third party, for example). Another use case is setting the ECID in a custom XDM field, in addition to having it in the identity map.
You can access the ECID either via Data Prep for Data Collection (recommended) or via tags.
If you are looking to set the ECID in a custom XDM field, in addition to having it in the identity map, you can do this by setting the source
to the following path:
xdm.identityMap.ECID[0].id
Then, set the target to an XDM path where the field is of type string
.
If you need to access the ECID on the client side, use the tags approach as described below.
Ensure your property is configured with rule component sequencing enabled.
Create a new rule.
Add a Library Loaded event to the rule.
Add a Custom Condition action to the rule with the following code (assuming the name you’ve configured for the SDK instance is alloy
):
return alloy("getIdentity")
.then(function(result) {
_satellite.setVar("ECID", result.identity.ECID);
});
Save the rule.
You should then be able to access the ECID in subsequent rules using %ECID%
or _satellite.getVar("ECID")
, like you would access any other data element.