Vanilla JavaScript
For a browser-rendered application, put the CDN loader in your shared HTML shell and call the global API only after the user action occurs.
<head> <script async src="https://cdn.movcues.com/v1.js" data-site-id="YOUR_SITE_ID"></script></head>document.querySelector("[data-upgrade]")?.addEventListener("click", () => { window.analytics.event("upgrade_clicked", { surface: "billing" });});Identify after your app authenticates
Section titled “Identify after your app authenticates”function onSignedIn(user) { window.analytics.identify(user.id, { plan: user.plan, workspace_id: user.workspaceId, });}Do not identify from an untrusted URL parameter or form field. Use the stable ID that your own app has already authenticated.
Clear identity on logout
Section titled “Clear identity on logout”function onSignedOut() { window.analytics.reset();}reset() creates a fresh anonymous and session context. It prevents the next person using the same browser session from being associated with the previous identity.