> ## Documentation Index
> Fetch the complete documentation index at: https://docs.highcovery.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Shopify

> Set up affiliate tracking manually in your Shopify shop

## Overview

For affiliate tracking you add two small scripts to your Shopify theme and create four webhooks in your Shopify admin. No app needs to be installed.

<Note>This guide only sets up the technical side in your shop. Whether clicks and orders are actually recorded also depends on your affiliate agreement, see [Affiliate tracking](/en/affiliate/tracking).</Note>

### Requirements

* An active **affiliate agreement** with a partner ID, see [Partner agreement](/en/affiliate/contract). The webhook URLs are shown only once your partner ID has been assigned.
* Access to your shop's **theme code** (Online Store → Themes → Edit code).
* Admin access to **Settings → Notifications** in Shopify to create webhooks.

## Setup

<Steps>
  <Step title="Open the integration">
    In the dashboard go to **Affiliate → Integration**, select your online shop at the top right and open the **Manual script** tab.
  </Step>

  <Step title="Add the cookie script to the head">
    Copy the **Cookie script** via *Copy script*. In Shopify open **Online Store → Themes → … → Edit code** and paste the script into `layout/theme.liquid` directly before `</head>`. The script already includes the `<script>` tags.
  </Step>

  <Step title="Add the core script before the end of the body">
    Copy the **Core script** and paste it into the same file directly before `</body>`. Save the theme.
  </Step>

  <Step title="Store the webhook secret">
    In Shopify open **Settings → Notifications → Webhooks**. At the bottom you find the signing key Shopify uses to sign webhooks. Copy it, enter it in the dashboard under **Shopify Webhook Secret** and click **Save secret**.
  </Step>

  <Step title="Create the webhooks in Shopify">
    In the dashboard you find four URLs under **Shopify Webhooks**. In Shopify, under **Settings → Notifications → Webhooks**, create one webhook per URL (format **JSON**):

    | Shopify event      | Highcovery URL          |
    | ------------------ | ----------------------- |
    | Order creation     | Order Created Webhook   |
    | Order payment      | Order Paid Webhook      |
    | Order cancellation | Order Cancelled Webhook |
    | Refund create      | Order Refunded Webhook  |

    For the **webhook API version**, choose the latest stable version Shopify offers (for example `2025-10` or newer). Highcovery only reads the standard order fields, which are included in all current versions.
  </Step>

  <Step title="Add coupon codes (optional)">
    Under **Coupon codes** you can enter codes separated by commas. If a customer uses one of these codes, the order is attributed to you even when no click ID is available.
  </Step>

  <Step title="Check the setup">
    Open a deeplink from the Highcovery app and place a test order with it. It appears on your affiliate page under **Recent activity**.
  </Step>
</Steps>

## How tracking works

1. A user clicks your product in the Highcovery app and lands in your shop with the URL parameters `hc_cid` (click ID) and `hc_pid` (partner ID).
2. The **cookie script** stores both values as cookies for **30 days**. It respects the Shopify Customer Privacy API: without marketing consent no cookie is set.
3. The **core script** writes the click ID into the cart as a cart attribute. That is how it ends up on the order.
4. The **webhooks** report every order to Highcovery. Highcovery reads the click ID from the order and creates the conversion. If it is missing, the coupon code fallback applies.
5. **Cancellations and refunds** are reported as well and adjust the commission.

<Warning>If you switch your theme, you must add both scripts to the new theme again. The webhooks remain in place.</Warning>

## Troubleshooting

* **No conversions despite orders** – check that both scripts are in the active theme and that the four webhooks in Shopify point to the correct URLs.
* **Webhooks are rejected** – the webhook secret in the dashboard must match the signing key from Shopify exactly. Save it again.
* **Orders with a coupon are not attributed** – the code must be entered under **Coupon codes** exactly as it is named in Shopify.
* **Tracking status inactive** – check the status banners on your affiliate page. They name the reason, for example a missing payment method.

<Tip>If you run into problems, contact [support@highcovery.com](mailto:support@highcovery.com) with your shop domain and the approximate time of the order.</Tip>
