Skip to Content
PlatformsWebQuickstart

Quickstart

npm install onesygnal-web-sdk
import oneSygnal from 'onesygnal-web-sdk'; oneSygnal.init('YOUR_API_KEY', { apiUrl: 'https://sdk-api.1sygnal.app' }); oneSygnal.track('page_viewed', { path: window.location.pathname }); oneSygnal.identify('user_123', { plan: 'pro' });

That’s it — surveys matching your active trigger rules will show automatically. apiUrl is required; init() throws without it (natives default to sdk-api.1sygnal.app with zero config, web doesn’t). See Configuration for the full options table.

init() on the loader returns void, not a Promise — there’s no await here because awaiting it wouldn’t tell you anything about readiness. If you need to know when the SDK is actually ready, see Events (web has no ready event; the nearest equivalent depends on which artifact you’re using).