Track signups with identify() in the browser
For single-page apps and custom flows: call identify() once the signup request succeeds.
Before you start
The Chartsy script must already be on every page of your site, including the app where signup happens - it supplies where the visitor came from; this guide only adds the email. See the installation guides.
For React, Vue, Svelte or any custom flow. This runs in the visitor's browser, where the Chartsy script reads its own cookies, so you only supply the email.
1Call identify() after signup succeeds
Once your signup request has succeeded - not on submit, and not on login.
const res = await fetch('/api/signup', { method: 'POST', body: form });
if (res.ok) {
window.chartsy?.identify({ email });
}2TypeScript: declare it once (optional)
declare global {
interface Window { chartsy?: { identify(p: { email: string }): void } }
}
export {};

