Install it in minutes
One script tag, one identify call and your cancel button. Everything else is optional.
Install the snippet
Paste it once in the head of every page of your app and your marketing site, signed in or not. On your site it sees where each visitor first came from (an ad, a search, another site) and carries it to their customer once they sign up. Your publishable key is on Settings, Install, and it's safe in the browser.
<script>
!function(w,d,g,k,u){w[g]=w[g]||function(){(w[g].q=w[g].q||[]).push(arguments)};
var s=d.createElement("script");s.async=1;s.src=u;s.dataset.key=k;s.dataset.global=g;
d.head.appendChild(s)}(window,document,"outchurn","pk_live_YOUR_PUBLISHABLE_KEY","https://app.outchurn.com/v1/embed.js");
</script>It loads in the background, about 5 KB, and never holds up your page.
If your site sets a Content Security Policy
Add our address to these three lines of the policy (in your Content-Security-Policy header or meta tag), or the browser blocks the snippet without a word. If your policy uses a nonce, give it to the snippet's script tag too.
script-src 'self' https://app.outchurn.com
connect-src 'self' https://app.outchurn.com
frame-src 'self' https://app.outchurn.comTell it who is signed in
Call identify after sign-in, on every page load. Pass your Stripe customer id, so what people do meets what they pay.
// After sign-in, on every page load
outchurn("identify", {
userId: user.id,
email: user.email,
stripeCustomerId: account.stripeCustomerId,
});userId: your own id for the person.email: shown on their customer page, never sent anywhere else.stripeCustomerId: links them to their billing.accountId (optional): when one account has many users.source (optional): where they came from, if you know it better than their first visit: google_ads, meta_ads, linkedin_ads, google, partner and so on, or their utm_source, utm_medium and utm_campaign.employees (optional): the company's headcount (a number, or a range like 11-50), to see which company sizes leave most.lang (optional): the language they use your product in (fr, de-CH). Without it, your page's language and then their browser's are used, to write to them in it.- Any other trait that describes the account, like industry or use_case (a short word, or true/false), becomes something to compare churn by once enough customers send it. The same words in a customer's Stripe metadata count too, from the moment Stripe is connected, and win over identify's.
Track what matters
Page views, clicks, rage clicks, dead clicks and errors are captured on their own. Send the moments that say a customer got value, and the analysis finds which ones keep them.
// When something worth counting happens
outchurn("track", "Report Created", { reportType: "weekly" });What it never collects
- What people type: field values are never read.
- Anything inside an element with
data-private, ordata-no-trackto skip its clicks too. - Emails and long numbers in button labels, masked before they leave the browser.
- Words in the pictures of your most clicked pages: every word is masked except your buttons, labels and menus, and images become blank boxes.
- More than where a visitor came from: the referring site's name and the campaign tags, never that page's address or query, never an ad click id's value. One cookie on your own domain holds just that, so your marketing site and your app agree; no id, nothing about the person.
- A session recording, unless you turn recordings on: then only signed-in users, a share of their sessions, with the same masking as the pictures (every word outside your buttons and menus, typed text and images hidden, anything inside data-private left out).
<div data-private>
<!-- never read, never in a picture -->
</div>What's held about a customer
When one of your customers asks what you hold about them, ask for their export from your server: their account (by Stripe customer id) or one person (by the user id you pass to identify), signed with your signing secret as for the cancel button, with a secret key. It carries everything keyed to them, what they did in your product and what mentions them, as JSON. The owner or an admin can also download it from the customer's page.
# HASH: the id signed with your signing secret, as for the cancel button
curl "https://app.outchurn.com/api/v1/export?customerId=cus_123&hash=$HASH" \
-H "Authorization: Bearer $SECRET_KEY" # or ?userId=user_42 for one personErasing a customer
When one of your customers asks to be erased, send their Stripe customer id (their account, every person in it and everything about them) or the user id you pass to identify (that person only: their visits, recordings and the support tickets they wrote; their company's account stays), signed with your signing secret as for the cancel button, with a secret key. A secret key alone can't erase anyone, so a key given to an AI assistant never can. Everything about them goes, later imports leave them out, and the same call again changes nothing. The owner can also do it from the customer's page.
# HASH: the id signed with your signing secret, as for the cancel button
curl -X POST https://app.outchurn.com/api/v1/erase \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"customerId": "cus_123", "hash": "'$HASH'"}' # or "userId" for one personCookie consent
If your visitors must agree first (a cookie banner in the EU or UK), call consent with false right after the snippet: until they agree, nothing is read from or written to their device (ids live in memory for that page, no first-touch cookie, no recording; a payment banner they close only remembers that it was closed). Call it with true once they agree, and a returning visitor keeps their ids. If they refuse or withdraw later, call it with false again and everything the snippet kept is removed. Without a call, the snippet keeps its ids as usual.
// Right after the snippet, until the visitor agrees: nothing is read or written on their device
outchurn("consent", false);
// When they accept analytics in your cookie banner
outchurn("consent", true);
// If they refuse or withdraw later: everything it kept is removed
outchurn("consent", false);Your cancel button
Your own button opens the cancel flow for the signed-in customer: add data-cancel, or call cancel yourself. The outcome is applied on your Stripe account, and onDone tells your page.
<!-- customerId and its signature come from your server -->
<button data-cancel
data-customer="{{ stripeCustomerId }}"
data-hash="{{ cancelHash }}">
Cancel subscription
</button>A cancel link, without the snippet
Where the snippet doesn't run (an email, a support reply, a mobile app), your server asks for one customer's link: the same cancel flow on a page of its own, in their language, sending them back to returnUrl when they're done. Send your secret key; customerId is their Stripe customer id, days how long the link lasts (7 by default, 30 at most).
curl -X POST https://app.outchurn.com/api/v1/cancel-link \
-H "Authorization: Bearer sk_live_YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"customerId":"cus_123","returnUrl":"https://app.example.com/account","lang":"fr"}'
# 201 { "url": "https://app.outchurn.com/w/leave?t=...", "expiresAt": "2026-11-25T09:00:00.000Z" }The link opens that customer's flow only, until it expires: send it to them alone. Each opening is a session like the embed's, in the same results.
Sign the customer id on your server
The cancel flow only trusts a customer id your server signed: an HMAC-SHA256 of the Stripe customer id with your signing secret, as hex. The secret is on Settings, Install; keep it on your server. If it ever leaks, replace it there: the old one keeps working for 24 hours while you deploy the new one.
import { createHmac } from "node:crypto";
const cancelHash = createHmac("sha256", process.env.CANCEL_SIGNING_SECRET)
.update(account.stripeCustomerId)
.digest("hex");Surveys, messages and the payment banner
Once someone is identified, the snippet shows what you've turned on: surveys at the moments you pick, follow-up messages, and the banner when a payment fails (or the pause wall for a paused customer, when you turn it on). You can also open them yourself. The snippet asks once per page what is waiting for that customer, and loads a frame only for what is.
Surveys
<!-- Asks only when this customer is due (your Surveys settings) -->
<div data-surveys
data-customer="{{ stripeCustomerId }}"
data-hash="{{ cancelHash }}"></div>Messages
<!-- Shows only when a follow-up left this customer a message -->
<div data-messages
data-customer="{{ stripeCustomerId }}"
data-hash="{{ cancelHash }}"></div>Payment banner
<!-- Shows only when this customer has a payment failing -->
<div data-payment-banner
data-customer="{{ stripeCustomerId }}"
data-hash="{{ cancelHash }}"></div>Send events from your server
For what happens outside the browser, like a report emailed or an export finished. Use a secret key from Settings, Install, and never put it in the browser.
POST /api/v1/track: one event, or up to 100 as an "events" list.POST /api/v1/identify: who a user is, or up to 100 people as a "people" list.
await fetch("https://app.outchurn.com/api/v1/track", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SERVER_EVENTS_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
event: "Report Emailed",
customerId: account.stripeCustomerId, // or userId, or email
id: `report-${report.id}`, // optional: a retry is stored once
}),
});Say who a user is
When someone signs up, or their account changes, tell us from your server: their userId with their customerId (the Stripe customer id), email, accountId or traits. A link your server makes is the trusted one: the browser can't move it, and the cancel flow and the pause wall then accept your own user id, signed, in place of the Stripe customer id. Traits add to what the snippet sends.
await fetch("https://app.outchurn.com/api/v1/identify", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SERVER_EVENTS_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
userId: user.id,
customerId: account.stripeCustomerId,
email: user.email,
traits: { employees: account.employees }, // optional
}),
});Send reviews
Your own reviews, or the ones you collect from a review site, sent from your server with a secret key: one at a time, or up to 100 at once as a "reviews" list. Reviews from your customers join what they say.
text: the review (required).rating: 1 to 5 stars.source: trustpilot, g2, capterra, app_store, google_play or own (the default).email or customerId: who wrote it (an email or a Stripe customer id), to match a customer.id: your own id, so sending it again updates it instead of adding a copy.title, author, url and at: optional.
curl https://app.outchurn.com/api/v1/reviews \
-H "Authorization: Bearer $SERVER_EVENTS_KEY" \
-H "Content-Type: application/json" \
-d '{"id":"review-1042","source":"own","rating":5,"title":"Our reports run themselves now","text":"Setup took an afternoon and the weekly report saves us hours.","email":"jane@acme.com","at":"2026-11-02T10:00:00Z"}'No code? Import a review site's CSV export, or add your testimonials feed (RSS, Atom or JSON) in Settings, Connections, Reviews.
Read your numbers
MRR, customers, churn over 3, 6 or 12 months and what each lever kept, for your own dashboards. A secret key; up to 60 calls a minute.
curl "https://app.outchurn.com/api/v1/metrics?months=12&window=6" \
-H "Authorization: Bearer $SERVER_EVENTS_KEY"Webhooks
Add an endpoint on Settings, Connections and pick the events. Each delivery is a POST with a JSON body, retried with backoff until your server answers with a 2xx; the same outcome is never sent twice.
| Event | When |
|---|---|
customer.saved | A customer is savedThe cancel flow kept them: the reason and the offer they took. |
customer.cancelled | A customer cancelsThey left through the cancel flow: the reason and their words. |
customer.at_risk | A warning sign catches a customerA follow-up started: the sign, their MRR and what it saw. |
survey.answered | A survey is answeredNPS, PMF or a quick question: the score and the reason. |
What a delivery looks like
A customer is saved customer.saved
{
"id": "evt_saved_cs_8f2KQ1x",
"type": "customer.saved",
"created": 1793715600,
"data": {
"customerId": "cus_Q2a9",
"cancelSession": "cs_8f2KQ1x",
"reason": "too_expensive",
"offer": {
"kind": "discount",
"percent": 30,
"months": 3
},
"months": null,
"comment": null
}
}A customer cancels customer.cancelled
{
"id": "evt_cancelled_cs_9h3LR2y",
"type": "customer.cancelled",
"created": 1793715600,
"data": {
"customerId": "cus_Z7b4",
"cancelSession": "cs_9h3LR2y",
"reason": "switched_service",
"offer": null,
"months": null,
"comment": "Moving to a tool our new team already uses."
}
}A warning sign catches a customer customer.at_risk
{
"id": "evt_risk_run_4kT2",
"type": "customer.at_risk",
"created": 1793715600,
"data": {
"customerId": "cus_M1c8",
"signal": "risk_high",
"mrrCents": 7900,
"currency": "usd",
"facts": {
"score": 72
},
"followUp": "run_4kT2"
}
}A survey is answered survey.answered
{
"id": "evt_survey_nps_77Qe",
"type": "survey.answered",
"created": 1793715600,
"data": {
"customerId": "cus_H5d2",
"survey": "nps",
"question": null,
"score": 9,
"text": "Reports save me an hour every Monday."
}
}Check a delivery is genuine
Every delivery carries a Webhook-Signature header: a timestamp and an HMAC-SHA256 of the timestamp and the raw body, keyed with your endpoint's secret. Compare in constant time, and refuse old timestamps.
import crypto from 'node:crypto';
// header: the Webhook-Signature header, "t=1730000000,v1=5f2c..."
// body: the raw request body, exactly as received (before any JSON parsing)
export function verify(header, body, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const t = Number(parts.t);
if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
const expected = crypto.createHmac('sha256', secret).update(`${t}.${body}`).digest('hex');
const given = Buffer.from(parts.v1 ?? '', 'hex');
return given.length === 32 && crypto.timingSafeEqual(given, Buffer.from(expected, 'hex'));
}Connect your AI assistant
Claude Code, ChatGPT, claude.ai, Cursor, Codex, Claude Desktop and any other assistant that speaks MCP can read your churn: why customers leave, the plan with a ready prompt for each change, who may leave and each customer's story. Make a secret key in Settings, Install, then add the server once. ChatGPT and claude.ai sign in through OAuth with that key. In Claude Code, type @ to attach a page (churn://summary, churn://plan, churn://why-they-leave, churn://at-risk and more) to any prompt. Where the assistant can show MCP Apps, answers arrive as live cards: churn at a glance with how it was lost, churn by month as a chart, why they leave and the plan ranked by money, who may leave with the reasons, what customers say with the MRR behind each theme, the cancel flow with each rescue's take rate, win-back with who to reach, what each change did before and after, today's outreach with what's ready for each customer, one customer with their risk, use and timeline, failed payments with each next step, and what each lever kept with the guarantee.
Try it now with the demo company's public key, sk_test_LumenDemoReadOnly0000000: it opens only Lumen, read-only.
claude mcp add --transport http outchurn https://app.outchurn.com/api/mcp --header "Authorization: Bearer sk_test_LumenDemoReadOnly0000000"churn_summary: MRR, churn rate, how revenue was lost and what each lever keptall_facts: every fact the engines computed, by topicwhy_they_leave: the findings behind the churn, biggest money firstchurn_by: monthly churn for every group along one dimension (plan, interval, source, country, company size, seats), with its 95% range and whether the difference is realthe_plan: every change worth making; pass an id for its prompt for a coding assistantcustomers_at_risk: who may leave in the next 30 days, with the reasonscustomer: one customer in full, by id or name, with your team's notes and reminderscustomers: the customer list by the Customers page's filters (at risk, renewing, failing, churned and more), plan, search and orderfailed_payments: payments in retries now with the best next step, and cards about to failcoming_up: what's due in the next 30 days, each customer with the day and the MRR at stake: discounts that run out, paused billing that starts again, yearly renewals, cards that expire before their charge, and your reminders.saves: what each lever kept beyond the company's usual, recent saves and the guaranteetrends: each of the last 12 months (MRR, customers, churn, what was lost and how), also as data to chartmonth_update: one complete month's churn for your investor or board update, the same lines as Monthly update on Resultsforecast: where MRR goes in the next 12 months at your pace, its likely range, and with churn down by the promise, also as data to chartcohorts: retention by signup month, customers and revenue, month by month, also as data to charttrials: how many trials pay, by plan and by month, what payers do first, and what the rest would have paid, also as data to chartvoice: the themes customers raise, with the MRR behind each, whether leavers raise them more, and quotesfollow_ups: which follow-up rules are on and what they didoutreach_queue: who the follow-up rules say to reach now, with each drafted email (approved or skipped in Outreach)cancel_flow: the cancel flow's results and the latest people through it, with their reason and choiceready_to_grow: the habit that goes with customers moving up each plan, and who has it but hasn't moved yetwin_back: who left and came back, lapsed customers to reach, and changes that answer what leavers asked forchanges: every change the company made and what churn did after itask: a judgment question for the product's own analyst (limited per hour)search: finds any page, finding, change in the plan, customer or theme from plain words, with a link to where it lives (what ChatGPT's deep research and company knowledge read through)fetch: one of them in full, by the id search gavedraft_email: saves an email to a customer as a draft that waits in Outreach for your approval (a key allowed to act)mark_plan_step: marks a change from the plan done, dismissed or open againlog_change: logs a change you made on a day, so churn before and after it is comparedadd_customer_note: adds a note to a customer's page for your team, with a reminder on a day if you want one (it waits in Outreach that day)mark_done: marks what waits in Outreach for a customer done once you've handled it (their follow-up's reach-out and reminders that are due; emails stay for you to review)set_follow_up: turns a follow-up rule off, or on when it reaches nobody without yousuggest_follow_up: suggests turning on a rule it can't turn on itself, with why; it waits in Outreach for youmake_cancel_link: a link to your cancel flow for one customer who asked to cancel where your button isn't, for you to send them (listed and revocable on their page)suggest_cancel_test: suggests a test of one reason's rescues, with why; it waits on your Cancel flow page until you add it and publish, or dismiss itsuggest_quick_question: suggests a quick question to ask customers right after something they did, with why; it waits in Settings, Surveys until you add it or dismiss itsuggest_audience: suggests giving a group of customers their own cancel flow (by plan, MRR, tenure, one of your attributes, country or US state, or what they've paid so far, with a direct way out if you want one), with why; it waits on your Cancel flow page until you add it and publish, or dismiss it
It also offers fourteen ready-made asks (Claude Code lists them as commands): weekly_review, top_change (makes the plan's top change in your codebase), who_to_call, why_this_month, chase_payments, win_back_round, grow_round, cancel_flow_tuneup, group_round (the group that leaves fastest, with its own rescue and follow-up), reminders_round (your reminders that are due, each drafted and marked done), cancel_requests (a reply to each customer who asked to cancel by email, in their language, their cancel link put in when you approve it), renewal_round (yearly plans renewing soon, each with what to do before the charge), investor_update (the churn part of your monthly investor update, in your voice) and customer_brief.
Every key reads. A key allowed to act (tick it when you make the key, or later beside it) also prepares the actions above, each held for you: emails are drafts that wait in Outreach, and every action is in the log under the key. With the demo key, actions are checked and described, never saved. Keys are made by owners and admins. Revoke a key to end everything made with it, or disconnect one app under Connected apps in Settings, Install.
See it with real keys
The demo company's Install page shows every sample with a key filled in.
Open the demo