Source: https://datafa.st/docs/attribution-guide-with-kajabi
Markdown source: https://datafa.st/docs/attribution-guide-with-kajabi.md
Description: Set up revenue attribution when using DataFast with Kajabi. Track course sales, coaching programs, and subscription revenue.

# Attribute revenue with Kajabi

← [Revenue attribution guide](/docs/revenue-attribution-guide)

# Attribute revenue with Kajabi

> Make sure you've [added DataFast tracking](/docs/kajabi) to your Kajabi site and [connected your Stripe account](/docs/connect-payment-provider) first.

### 1. Access your Kajabi thank you page

1. Log in to your Kajabi dashboard
2. Go to **Products** and select the product you want to track
3. Click **Edit** > **Checkout** > **Thank You Page**

### 2. Add the DataFast tracking code

Add this JavaScript code to your thank you page:

```html
<script id="datafast-queue">
  window.datafast = window.datafast || function() {
    window.datafast.q = window.datafast.q || [];
    window.datafast.q.push(arguments);
  };
</script>
<script>
try {
  // Get customer email from Kajabi's checkout data
  // Kajabi usually stores customer email in the URL or page data
  const urlParams = new URLSearchParams(window.location.search);
  const customerEmail = urlParams.get('email') || 
                       document.querySelector('[data-customer-email]')?.textContent ||
                       document.querySelector('input[name="email"]')?.value;

  if (customerEmail) {
    window.datafast("payment", { email: customerEmail });
  }
} catch (e) {
  console.error("DataFast tracking error:", e);
}
</script>
```

### 3. Save and test

1. Save your thank you page
2. Make a test purchase to verify the tracking works
3. Check your [DataFast dashboard](/dashboard) for revenue data

## Alternative: Use Kajabi's custom code section

If you have access to Kajabi's theme editor:

1. Go to **Website** > **Themes** > **Customize**
2. Find the **Custom Code** or **Footer Code** section
3. Add the tracking code there instead

> After a successful purchase, you should see revenue data in your DataFast dashboard.
