SDKsWeb
Getting started
How the MotiSig web SDK fits into your site at runtime.
Prerequisites
Before loading the SDK in the browser:
- Create an SDK key and note your project ID (Settings → API Keys).
- Add your site's origin under Settings → API Keys → SDK → Allowed web domains (for example
https://app.example.com, orhttp://localhost:3000for local dev). See Allowed web domains.
Overview
- Load the SDK once (script tag).
- Track anonymous behavior with
event()before login (optional). - After auth succeeds, call
identify(userId, extras)— same for sign-up and sign-in. - On sign-out, call
logout()(keeps anonymous visitor id). - Use
updateUser, tags, attributes, andevent()for ongoing engagement.
flowchart LR
init[script tag]
anon[event with anonymousId]
identify[identify after auth]
ongoing[events / profile / tags]
init --> anon
anon --> identify
identify --> ongoingScript tag
Add the tag in your root layout or _document:
<script
src="https://motisig.ai/cdn/web/v1/motisig.js"
data-sdk-key="YOUR_SDK_KEY"
data-project-id="YOUR_PROJECT_ID"
async
></script>Then call the global API:
window.motisig.event('pricing_viewed', { tier: 'indie' });
// After your auth system reports a signed-in user:
await window.motisig.identify(firebaseUser.uid, { email: firebaseUser.email });See Auth integration for full sign-in / sign-out patterns.
Sign-up vs sign-in
There is no separate register API. Both flows call identify / POST /users:
- New user → HTTP 200, audience user created
- Returning user → HTTP 409, SDK ignores and continues
Call identify on every login with your auth system's stable user id (Firebase UID, database id, Auth0 sub).