SDKsWeb
User and profile
identify, updateUser, getUser, logout, reset, and profile enrichment for the MotiSig web SDK.
identify(userId, extras?)
Registers the audience user (POST /users) and switches the SDK to that user id.
- Sends
platform: web, browser timezone/locale, and optionalanonymousIdfrom pre-login tracking. - HTTP 409 (user already exists) is treated as success — safe on every login.
- Required before
updateUser,getUser, tags, and attributes.
await window.motisig.identify('user-123', {
email: 'ada@example.com',
firstName: 'Ada',
lastName: 'Lovelace',
tags: ['trial'],
customAttributes: { plan: 'pro' },
});updateUser(payload)
PATCH /users/{id} with profile fields:
await window.motisig.updateUser({
firstName: 'Ada',
lastName: 'Lovelace',
email: 'ada@example.com',
});Throws if identify has not been called.
getUser()
const user = await window.motisig.getUser();Returns the server user document, or null if not identified / not found.
logout()
Clears the identified user only. Preserves the anonymous visitor id so post-sign-out events continue anonymously. Does not delete the server user.
window.motisig.logout();reset()
Full local wipe: identified user, anonymous id, and activity tracking. Use for GDPR opt-out or hard reset — not for auth sign-out.
window.motisig.reset();Tags and attributes
await window.motisig.addTags(['beta']);
await window.motisig.removeTags(['trial']);
await window.motisig.addOrUpdateAttributes({ plan: 'pro' });
await window.motisig.removeAttributes(['legacy_field']);