Install Widget

Add ChurnRecovery to your app in under 5 minutes. Choose your preferred integration method.

1

Add the script tag

Add this snippet before the closing </body> tag on every page of your app.

HTML
<script
  src="https://cdn.churnrecovery.com/widget.js"
  data-project="proj_YOUR_PROJECT_ID"
  data-api-key="cr_live_YOUR_API_KEY"
  async
></script>
2

Trigger the cancel flow

Call ChurnRecovery.showCancelFlow() when a user clicks your cancel button.

JavaScript
document.getElementById('cancel-btn').addEventListener('click', async () => {
  const result = await ChurnRecovery.showCancelFlow({
    customerId: 'cus_123',          // Your customer ID
    subscriptionId: 'sub_456',      // Subscription ID
    planName: 'Pro Plan',           // Plan name shown in modal
    mrr: 49.00,                     // Monthly revenue (for analytics)
  })

  if (result.saved) {
    alert('Welcome back! Your offer has been applied.')
  } else {
    // Process cancellation in your system
    cancelSubscription(result.customerId)
  }
})
3

You're done!

💡 That's it! The widget handles the cancel flow UI, reason collection, offer presentation, and event logging automatically.

✅ Verify Installation

After installing, trigger a test cancel flow. You should see the modal appear with your configured reasons and offers. Events will appear in your Analytics tab within seconds.

Check AnalyticsFull Documentation →