getIdentity
When you run the sendEvent
command, the Web SDK automatically obtains the visitor’s identity if one is not already present.
The getIdentity
command allows you to obtain a visitor ID without sending event data.
If you require separate calls to generate a visitor ID and send data, you can use this command.
The getIdentity
command goes through the following flow to retrieve the ECID
.
getIdentity
or appendIdentityToUrl
.ECID
namespace was requested on the call. By default, the ECID
namespace is always included.kndctr
cookie and returns its value as ECID
, if it exists. This only returns the ECID
value, but not the regionId
.kndctr
identity cookie is not set or the "CORE"
namespace was requested, Web SDK makes a request to the Edge Network.ECID
and the regionId
(and the CORE ID
, if requested).The Web SDK tag extension does not offer this command through the tag extension UI. Use the custom code editor using JavaScript library syntax.
Run the getIdentity
command when calling your configured instance of the Web SDK. The following options are available when configuring this command:
namespaces
: An array of namespaces. The default value is ["ECID"]
. Other supported values include:
["CORE"]
["ECID","CORE"]
null
undefined
You can request ECID and CORE ID at the same time. Example: "namespaces": ["ECID","CORE"]
.
edgeConfigOverrides
: A datastream configuration override object.
alloy("getIdentity",{
"namespaces": ["ECID","CORE"] //this command retrieves both ECID and CORE IDs.
});
If you decide to handle responses with this command, the following properties are available in the response object:
identity.ECID
: A string containing the visitor’s ECID.identity.CORE
: A string containing the visitor’s CORE ID.edge.regionID
: An integer that represents the Edge Network region that the browser hit when acquiring an identity. It is the same as the legacy Audience Manager location hint.