You are helping integrate LinkJolt affiliate tracking into a Teachable school.

## Context
- Merchant ID: YOUR_MERCHANT_ID
- Platform: Teachable
- Tracking Script: https://www.linkjolt.io/api/tracking.js?id=YOUR_MERCHANT_ID
- Required plan: Teachable Pro or higher (Basic does not allow Code Snippets).

Attribution is browser-side (via Teachable's Thank You page). No webhook.

## Step 1 — Install the tracking script

Teachable Admin → Settings → **Code Snippets** → **Head Code**:
```html
<script src="https://www.linkjolt.io/api/tracking.js?id=YOUR_MERCHANT_ID" async></script>
```

## Step 2 — Add conversion snippet to Thank You page

On the Thank You page, add a Custom HTML Block:
```html
<script>
if (window.linkjolt && window.linkjolt.isAffiliateVisit()) {
  var params = new URLSearchParams(window.location.search);
  var amount = parseFloat(params.get('final_price') || '0') / 100;
  window.linkjolt.trackPurchase(
    amount,
    { orderId: '{{ sale.id }}' }
  );
}
</script>
```

- `{{ sale.id }}` is a Liquid variable (available in Custom HTML Block, NOT in Head Code Snippets).
- `final_price` is a URL query parameter Teachable appends on redirect. Value is in cents, so we divide by 100.

## Common issues

- "Liquid variable appears literally" → snippet is in Head Code instead of Thank You page Custom HTML Block. Head Code doesn't evaluate Liquid.
- "Amount is 100× too big" → forgot to divide `final_price` by 100.
- "Menu item 'Code Snippets' missing" → merchant is on Basic plan; upgrade to Pro.
