Documentation
Three integration points: the script, custom events, and the revenue API.
Website agent integration guide
Send these snippets exactly as written. Replace YOUR_SITE_KEY and YOUR_INGEST_SECRET with the values from the Websites page.
1. Paste the base script in <head>
<script defer data-site="YOUR_SITE_KEY" src="https://data-dog.lovable.app/api/public/script.js"> </script>
2. Identify returning users on every authenticated app load
This merges sessions across devices and surfaces subscription status, plan, lifetime value, and MRR in Pulsefast.
<script>
window.pulsefast = window.pulsefast || function () {
(window.pulsefast.q = window.pulsefast.q || []).push(arguments);
};
const user = /* your current user object */;
if (user) {
pulsefast("identify", {
email: user.email,
name: user.name,
userId: user.id,
subscriptionStatus: user.subscriptionStatus, // active | trialing | past_due | canceled | free
plan: user.planName, // e.g. "Pro"
totalPaidCents: user.totalPaidCents || 0, // lifetime total in cents
mrrCents: user.mrrCents || 0 // current monthly recurring revenue in cents
});
}
</script>3. Fire a signup event after successful registration
pulsefast("signup", {
plan: "startup",
channel: "organic"
});Queue-safe fallback if the script has not loaded yet:
window.pulsefast = window.pulsefast || { q: [] };
window.pulsefast.q.push(["signup", { plan: "startup", channel: "organic" }]);4. Report payments from your backend
Send these from a server, Stripe webhook, or payment provider. Use the buyer's email, or match by client_id / visitor_hash if you already identified them.
# One-time payment
curl -X POST https://data-dog.lovable.app/api/public/revenue \
-H "Authorization: Bearer YOUR_INGEST_SECRET" \
-H "Content-Type: application/json" \
-d '{
"site": "YOUR_SITE_KEY",
"kind": "one_time",
"amount_cents": 4900,
"currency": "USD",
"email": "ada@example.com",
"customer_ref": "cus_123"
}'
# Subscription payment
curl -X POST https://data-dog.lovable.app/api/public/revenue \
-H "Authorization: Bearer YOUR_INGEST_SECRET" \
-H "Content-Type: application/json" \
-d '{
"site": "YOUR_SITE_KEY",
"kind": "subscription",
"amount_cents": 2900,
"currency": "USD",
"email": "ada@example.com",
"customer_ref": "cus_123"
}'
# Refund
curl -X POST https://data-dog.lovable.app/api/public/revenue \
-H "Authorization: Bearer YOUR_INGEST_SECRET" \
-H "Content-Type: application/json" \
-d '{
"site": "YOUR_SITE_KEY",
"kind": "refund",
"amount_cents": 2900,
"currency": "USD",
"email": "ada@example.com"
}'5. Sync subscription status and lifetime value from your backend
Use this when you do not want to expose revenue numbers in the browser, or when a webhook updates a user's plan.
curl -X POST https://data-dog.lovable.app/api/public/identify \
-H "Authorization: Bearer YOUR_INGEST_SECRET" \
-H "Content-Type: application/json" \
-d '{
"site": "YOUR_SITE_KEY",
"email": "ada@example.com",
"user_id": "usr_123",
"name": "Ada Lovelace",
"subscription_status": "active",
"subscription_plan": "Pro",
"subscription_renews_at": "2026-09-01T00:00:00Z",
"total_paid_cents": 24900,
"mrr_cents": 2900
}'6. Verification checklist
- Open the Pulsefast Visitors page — you should see live pageview dots on the map within seconds.
- After a user logs in, their email should replace the anonymous pseudonym in the visitor list.
- After a signup event, the visitor row should show a conversion score or a signup badge.
- After a revenue event, the same visitor should show a Customer badge and a non-zero lifetime value.
- If subscription status is sent, the visitor should display Active, Trial, Past due, or Canceled instead of a likelihood score.
1. Install the script
Copy your site key from the Websites page and drop this before </head>.
<script defer data-site="YOUR_SITE_KEY" src="https://data-dog.lovable.app/api/public/script.js"> </script>
Pageviews (including SPA route changes) are tracked automatically. No cookies are set.
2. Track custom events
Call window.pulsefast anywhere in your frontend. Use these names in goals and funnels.
pulsefast("signup", { plan: "startup" });
pulsefast("checkout_started");Already running another analytics tool? We never overwrite an existing window.datafast — that legacy alias is only set when the name is free. You can also choose your own global with data-global:
<script defer
data-site="YOUR_SITE_KEY"
data-global="pf"
src="https://data-dog.lovable.app/api/public/script.js">
</script>
pf("signup");Calls made before the script loads are kept if you queue them: window.pulsefast = window.pulsefast || { q: [] }; then window.pulsefast.q.push(["signup"]).
3. Track signups
Fire a signup event right after a successful registration. Add any traits you want to segment by later — plan, channel, or UTM values.
pulsefast("signup", {
plan: "startup",
channel: "organic"
});If the script hasn't loaded yet, queue the call so it isn't lost:
window.pulsefast = window.pulsefast || { q: [] };
window.pulsefast.q.push(["signup", { plan: "startup" }]);Pair this with identify (next section) on the same page so the signup is tied to a real person.
4. Identify signed-up users
Once someone signs up or logs in, attach their email so the visitor stops being anonymous — their name and email then show up in the live map, visitor list and journey.
pulsefast("identify", {
email: "ada@example.com",
name: "Ada Lovelace",
userId: "user_123"
});You can also identify from your backend with the site's ingest secret, matching on the browser's client id, the visitor hash or your own user id.
curl -X POST https://data-dog.lovable.app/api/public/identify \
-H "Authorization: Bearer YOUR_INGEST_SECRET" \
-H "Content-Type: application/json" \
-d '{
"site": "YOUR_SITE_KEY",
"email": "ada@example.com",
"name": "Ada Lovelace",
"user_id": "user_123"
}'4b. Keep existing users identified
Users who signed up before you installed Pulsefast stay anonymous until their browser calls identify once. Call it on every session — not just at signup — and your existing base fills in as people come back. The call is idempotent, so repeating it on each visit is safe and costs nothing.
// Run once on app load, whenever a session already exists.
const user = await getCurrentUser();
if (user) {
pulsefast("identify", {
email: user.email,
name: user.name,
userId: user.id
});
}If your app code can run before the tracking script finishes loading, queue the call — the script replays anything queued on window.pulsefast.q once it boots.
window.pulsefast = window.pulsefast || function () {
(window.pulsefast.q = window.pulsefast.q || []).push(arguments);
};
pulsefast("identify", { email: user.email, userId: user.id });Place it in three spots: after login, after signup, and on app load for an existing session. Once someone is identified, past payments recorded with their user id as customer_ref are linked back to them automatically.
4c. Send subscription status from your backend
Pass the subscription your own database knows about along with the identify call, and Pulsefast shows it as a badge in the visitor list and on the visitor panel. Allowed values: active, trialing, past_due, canceled, free.
pulsefast("identify", {
email: user.email,
name: user.name,
userId: user.id,
subscriptionStatus: user.subscriptionStatus, // active | trialing | past_due | canceled | free
plan: "Pro", // optional label
renewsAt: "2026-09-01T00:00:00Z", // optional
totalPaidCents: 24900, // optional lifetime value, in cents
mrrCents: 2900 // optional monthly recurring revenue
});Server-to-server (for example after a billing change), post to the identify endpoint with your ingest secret:
curl -X POST https://data-dog.lovable.app/api/public/identify \
-H "Authorization: Bearer YOUR_INGEST_SECRET" \
-H "Content-Type: application/json" \
-d '{
"site": "YOUR_SITE_KEY",
"email": "user@example.com",
"user_id": "user_123",
"subscription_status": "active",
"subscription_plan": "Pro",
"subscription_renews_at": "2026-09-01T00:00:00Z",
"total_paid_cents": 24900,
"mrr_cents": 2900
}'Subscribers show as Customer / Trial / Past due instead of a conversion score, and the lifetime value shown is the higher of recorded payments and total_paid_cents.
5. Report payments
Send payments from your backend (or a Stripe webhook) with the site's ingest secret. Include the visitor hash, client id or the buyer's email and the payment is attributed to that visitor's original channel. Supported kinds: one_time, subscription, refund.
curl -X POST https://data-dog.lovable.app/api/public/revenue \
-H "Authorization: Bearer YOUR_INGEST_SECRET" \
-H "Content-Type: application/json" \
-d '{
"site": "YOUR_SITE_KEY",
"amount_cents": 4900,
"currency": "USD",
"email": "ada@example.com",
"customer_ref": "cus_123",
"kind": "subscription"
}'If you already identified the buyer via identify, you can match by client_id or visitor_hash instead of email. The response tells you whether it landed: { ok: true, matched: true }. When matched is false the payment was stored but no person could be found for it.
Why is lifetime value zero?
LTV is only as good as the revenue signals you send. Check all three:
- Identify includes revenue. Sending only
emailandsubscriptionStatusis not enough — addtotalPaidCents(and optionallymrrCents). - Payments carry an identifier. A call to
/api/public/revenuewith onlycustomer_refmatches nobody unless you also send the same value ascustomerRefinidentify. Safest is to includeemailorclient_id. - Check the response. Both endpoints now return
matchedand areasonwhen nothing was linked — log it in your webhook.
// Browser: link the billing customer to the person
pulsefast("identify", {
email: user.email,
userId: user.id,
customerRef: user.stripeCustomerId, // matches customer_ref on payments
subscriptionStatus: "active",
plan: "Pro",
totalPaidCents: user.totalPaidCents,
mrrCents: user.mrrCents
});Payments that arrived before the person was identified are attached retroactively as soon as a matching customerRef or userId is identified.
Privacy model
- No cookies. A single first-party client id is stored in localStorage so repeat visits merge into one person.
- Anonymous visitors are keyed by a salted hash that rotates every day.
- Emails are only stored when you explicitly identify a user.
- IP addresses are hashed on arrival and never stored.
- Requests from browsers with Do Not Track enabled are ignored.