unsetUserIdentities method and specifying the identities that you want to remove.
Call the method as follows:
setUserIdentities will be removed.
Key Matching Requirement
Each entry inremovedPropertyKeys must exactly match the identifier key that was previously passed to setUserIdentities. The key to use depends on how identities were originally set:
- Raw identifiers (Scenarios 1 & 3): use the raw key — e.g.,
email,cellno,loginid. - Pre-hashed identifiers (Scenario 2): use the specific hashed key that was supplied — e.g.,
email_sha256_lowercase,cellno_with_country_code_sha256,loginid_md5_uppercase.
setUserIdentities({ email_sha256_lowercase: '...' }), you must pass 'email_sha256_lowercase' (not 'email') to remove that entry.
See the PII Identifier Key Reference for the full list of supported keys.
Storage Cleared
CallingunsetUserIdentities removes the matching keys from the persisted identity profile in browser storage. Which storage is affected depends on your persistenceInCookieStorage configuration:
persistenceInCookieStorage: false(default): identities are stored insessionStorageunder a key of the formzpstorage_*identity. The matching entries are removed from that key.persistenceInCookieStorage: true: identities are stored in cookies (namedzpstorage_*identity). The matching cookies are cleared.
user node of subsequent event payloads.
Parameters
| Parameter | Type | Description |
|---|---|---|
| removedPropertyKeys | Array | Keys to remove. Each key must exactly match a key previously supplied to setUserIdentities — use raw keys (e.g., email, cellno, loginid) if raw identifiers were set, or the specific hashed key (e.g., email_sha256_lowercase) if pre-hashed identifiers were set. The corresponding entries are deleted from sessionStorage (zpstorage_*identity) or from cookies when persistenceInCookieStorage: true is configured. If omitted, all identities set via setUserIdentities are cleared. |