# Attribute revenue with Kajabi

> Credit Kajabi course, coaching and membership sales to the visits that brought the buyer, through Stripe.

Source: https://metricraven.com/docs/attribution-guide-with-kajabi  
Markdown: https://metricraven.com/docs/attribution-guide-with-kajabi.md  
Section: Revenue

Kajabi charges through your Stripe account, but its checkout can't carry the visitor ID. Pass the buyer's email from the thank-you page and MetricRaven matches the Stripe payment to the visit.

> **Note:** First [install MetricRaven on Kajabi](https://metricraven.com/docs/install-kajabi) and [connect Stripe](https://metricraven.com/docs/stripe).

## Add the code to your thank-you page

1. **Open the offer's thank-you page**

   In Kajabi, open **Sales → Offers**, choose the offer, then **Checkout settings → Thank you page**. Edit the page and add a **Custom code** block.

2. **Paste this code**

   ```html title="Custom code block"
   <script>
     window.metricraven = window.metricraven || { q: [] };
     window.metricraven.payment = window.metricraven.payment || function () {
       window.metricraven.q.push(["payment"].concat([].slice.call(arguments)));
     };
   </script>
   <script>
     try {
       // Kajabi puts the buyer's email in the thank-you page URL or page data, depending on the theme.
       var params = new URLSearchParams(window.location.search);
       var el = document.querySelector("[data-customer-email]");
       var input = document.querySelector('input[name="email"]');
       var email = params.get("email") || (el && el.textContent.trim()) || (input && input.value);
       if (email) window.metricraven.payment({ email: email });
     } catch (e) {
       console.error("MetricRaven payment tracking error:", e);
     }
   </script>
   ```

   Check that your thank-you page actually shows or receives the email: open it after a test purchase and look for `?email=` in the address or the email on the page. Adjust the selector if your theme puts it elsewhere.

3. **Save and publish**

   Repeat for each offer you sell, or use a shared thank-you page.

If your theme has a site-wide **Footer code** (Website → Design → Customize), you can paste the code there instead; it only calls MetricRaven on pages that carry an email.

> **Verify it works**
>
> Make a test purchase in a private window. Once Stripe sync imports the payment (about a minute), it appears in **Revenue** credited to that visit's source.

## Notes

- Repeat loads of the thank-you page are ignored.
- Payment plans and subscription renewals keep the same visit through the Stripe customer.
- Matching rules, privacy and the security model: [Attribute by email](https://metricraven.com/docs/attribute-by-email).
