Skip to main content
SDKsWeb

Getting started

How the MotiSig web SDK fits into your site at runtime.

Prerequisites

Before loading the SDK in the browser:

  1. Create an SDK key and note your project ID (Settings → API Keys).
  2. Add your site's origin under Settings → API Keys → SDK → Allowed web domains (for example https://app.example.com, or http://localhost:3000 for local dev). See Allowed web domains.

Overview

  1. Load the SDK once (script tag).
  2. Track anonymous behavior with event() before login (optional).
  3. After auth succeeds, call identify(userId, extras) — same for sign-up and sign-in.
  4. On sign-out, call logout() (keeps anonymous visitor id).
  5. Use updateUser, tags, attributes, and event() 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 --> ongoing

Script 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).