---
updatedAt: 2026-04-14T05:29:57.000Z
agentTools:
  projectIndex: https://docs.developers.convert.com/llms.txt
---

# Churn Prediction Offer

```javascript Node.js
// --- Server Implementation ---

// 1. Global Initialization (Run once at app startup)
import { ConvertSDK } from '@convertcom/js-sdk';

const convert = new ConvertSDK({
  sdkKey: 'YOUR_SDK_KEY',
  dataStore: null
});

// 2. Per-Request Logic (Run for each user request)
async function handleRequest(req, res) {
  await convert.onReady();
  const user = req.user;

  const context = convert.createContext(user.id, {
    isChurnRisk: true // Determined by your backend logic
  });

  const variation = context.runExperience('churn-risk-offer');
  const offerType = variation?.key;
  
  // Provide special offer if applicable
  if (offerType === 'support_call') {
    res.json({ showSupportPopup: true });
  } else {
    res.json({ showDiscountBanner: true });
  }
}


// --- Goal Tracking ---

// Re-create context to track conversion
const context = convert.createContext(user.id);

context.trackConversion('offer-redeemed');
```
```typescript TypeScript
// --- Server Implementation ---

// 1. Global Initialization (Run once at app startup)
import { ConvertSDK, Context } from '@convertcom/js-sdk';

const convert = new ConvertSDK({
  sdkKey: 'YOUR_SDK_KEY',
  dataStore: null
});

// 2. Per-Request Logic (Run for each user request)
async function handleRequest(req: any, res: any) {
  await convert.onReady();
  const user = req.user;

  const context: Context = convert.createContext(user.id, {
    isChurnRisk: true // Determined by your backend logic
  });

  const variation = context.runExperience('churn-risk-offer');
  const offerType = variation?.key;
  
  // Provide special offer if applicable
  if (offerType === 'support_call') {
    res.json({ showSupportPopup: true });
  } else {
    res.json({ showDiscountBanner: true });
  }
}


// --- Goal Tracking ---

// Re-create context to track conversion
const context: Context = convert.createContext(user.id);

context.trackConversion('offer-redeemed');
```

# Overview

<!-- javascript@4-10 -->

**Type:** `a/b_fullstack` | **Key:** `churn-risk-offer` | **Target:** `/account/settings`

**Category:** Retention

Offer a discount or special support to users identified as high churn risk.

# Per-Request Logic

<!-- javascript@12-31 -->

Create a visitor context and run the experience to determine which variation to show. Apply the variation logic to the response.

# Goal Tracking

<!-- javascript@33-38 -->

Track the conversion event when the user completes the target action.