Quick start
From a new site to your first pageview, event and purchase in about five minutes.
Create a site
In the dashboard, add a website. Enter its name, the domain without a protocol (like acme.com) and its timezone. Every site gets two tokens:
- a public token (
pub_…) for the browser, shown with the install snippet; - a secret token (
sec_…) for your server, used only for revenue. Regenerate it in the site's settings to see it; it's shown once.
Install the tracker
Pick how your site is built. Every option sends a pageview on load and on each client-side navigation.
Paste this into the <head> of every page.
<script
defer
src="https://cdn.jsdelivr.net/npm/@supapulse/core@1/dist/browser.js"
data-token="YOUR_PUBLIC_TOKEN"
></script>Verify your first pageview
Deploy, then open your site in a new tab. The dashboard switches from waiting for the first pageview to live within a few seconds, and you get an email about it.
Nothing showing up?
Requests from a domain that doesn't match the site return 403 Origin not allowed. Check the domain in the site's settings, and turn on debugging (data-debug="true" on the script tag, or debug: true in the config) to log every send to the console.
Track an event
Call event() with a name and optional properties. Names are free-form, up to 255 characters; short snake case names read best in reports.
supapulse.event('signup', {
plan: 'growth',
source: 'pricing_page',
});With the script tag, the tracker is window.supapulse. In React, use useEvent().
Track revenue
Revenue is sent from Stripe or your server, never from the browser. Identify the customer after login or signup, then connect Stripe or post revenue events from your server with the secret token.
Public vs secret token.
The pub_ token is safe in the browser and can send pageviews, events and identify calls. The sec_ token can also send revenue. Keep it in a server environment variable and never ship it to the client.
supapulse.identify(user.id);With Stripe, paste the endpoint from the site's settings into the Stripe dashboard and you're done. For other processors, post from your webhook:
await fetch('https://supapulse.app/api/ingest', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Token': process.env.SUPAPULSE_SECRET_TOKEN!,
},
body: JSON.stringify({
type: 'revenue',
data: {
customer_id: user.id,
amount: 49.9,
currency: 'USD',
transaction_id: invoice.id,
event_type: 'purchase',
},
}),
});