Docs

Identify users

Tell Cueston who is signed in, so guidance can target them and "show once" works across devices.

Call identify as soon as you know who is signed in, and reset when they sign out.

JavaScript
Cueston.identify("user-123", {
  name: "Ada",
  email: "ada@acme.com",
  role: "admin",
  permissions: ["billing:manage", "reports:view"],
  plan: "pro",
});

// When they sign out:
Cueston.reset();
  • The user id should be your own stable account id, not an email address. It makes "show once" and checklist progress follow the person across browsers and devices.
  • Traits drive targeting. They're used in the browser to decide what to show; the snippet doesn't send them to Cueston.
  • reset() forgets the user, starts a new anonymous id and clears the local frequency state.

Traits you can target

TraitExampleTarget it with
role"admin"Audience → Role
permissions["billing:manage"]Audience → Permissions
plan"pro"Audience → Plan
any other keycompany_size: 50Audience → Custom attribute
name, email"Ada"Personalised text such as {{firstName}}

Visitors you don't identify only see content without targeting rules.

In a React app

TSX
// Wherever you know the signed-in user (an auth provider or app shell)
import { useEffect } from "react";

declare global {
  interface Window {
    Cueston: { identify(id: string, traits?: Record<string, unknown>): void; reset(): void };
  }
}

export function useCuestonIdentity(user: AppUser | null) {
  useEffect(() => {
    if (user) {
      window.Cueston.identify(user.id, {
        name: user.name,
        email: user.email,
        role: user.role,
        permissions: user.permissions,
        plan: user.plan,
      });
    } else {
      window.Cueston.reset();
    }
  }, [user]);
}

Google Tag Manager

Fire a Custom HTML tag after sign-in (for example on a login dataLayer event). {{User ID}} and the others are GTM variables you map from your dataLayer.

HTML
<script>
  Cueston.identify({{User ID}}, {
    name: {{User name}},
    email: {{User email}},
    role: {{User role}},
    permissions: {{User permissions}},
    plan: {{User plan}},
  });
</script>
<!-- On a "logout" event, fire a tag with: <script>Cueston.reset();</script> -->

Other forms

identify also accepts one object, and the script tag can identify the user for server-rendered pages:

JavaScript
Cueston.identify({ userId: "user-123", role: "admin", plan: "pro" });
HTML
<script src="https://app.cueston.com/sdk/v1/cueston.js" data-key="pk_…"
  data-user-id="user-123" data-user-email="ada@acme.com" data-user-name="Ada" async></script>

Verify identities

Your publishable key is public, so anyone who knows a user id could claim to be that user from the browser console. Turn on identity verification so your server signs each user id, and pass the signature as the third argument:

JavaScript
Cueston.identify(user.id, { role: user.role }, { userHash });

On this page