Web SDK
The Web SDK is the @signalsparrow/sdk package used by React, Vue, and plain JavaScript sites. If you installed the HTML snippet instead, the exact same methods are available on the global window.rp object.
Setup
Install the package:
npm install @signalsparrow/sdk
Then initialize it once, as early as possible, using the Public API key from Settings → Tracking:
import { init } from '@signalsparrow/sdk';
init('pk_live_YOUR_PUBLIC_KEY');
Using the HTML snippet? Initialization is already handled for you — skip straight to the methods below via window.rp.
Configuration options
init accepts an optional second argument:
init('pk_live_YOUR_PUBLIC_KEY', {
host: 'https://track.yourdomain.com',
consentMode: 'anonymous',
autoPageview: true,
debug: false,
});
| Option | Type | Default | What it does |
|---|---|---|---|
host | string | Your first-party domain | Where events are sent. Usually set automatically from Settings → Tracking. |
consentMode | 'anonymous' | 'hold' | 'anonymous' | How the SDK behaves before a visitor consents. See Consent & Privacy Modes. |
autoPageview | boolean | true | Automatically record a page view on load and on route changes. |
debug | boolean | false | Print helpful messages to the browser console while testing. |
Methods
identify(email)
Links the current visitor to a known person, usually right after signup or login. This is the single most important call for accuracy.
import { identify } from '@signalsparrow/sdk';
identify('user@example.com');
The email is scrambled (hashed) before it leaves the browser. Full details in Identifying Users.
track(eventName, properties?)
Optionally record a custom action from your site, such as a demo request.
import { track } from '@signalsparrow/sdk';
track('Demo Requested', { plan: 'growth' });
track for revenueYour paying-customer events (subscriptions, upgrades, and so on) come straight from Stripe automatically. Use track only for extra front-end actions you want to measure.
grantConsent()
Releases tracking when you're using consentMode: 'hold' — call it once the visitor accepts your cookie banner.
import { grantConsent } from '@signalsparrow/sdk';
grantConsent();
Using the global object
With the HTML snippet, call the same methods on window.rp:
<script>
if (window.rp) {
rp.identify('user@example.com');
}
</script>
Next
- Next.js SDK — the
@signalsparrow/nextpackage - Identifying Users — the one call that drives your match rate