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

# Shopify

> Set up Northbeam tracking on a store that uses Shopify's checkout.

Use this guide if your store uses **Shopify's checkout**. If it doesn't, follow the [Custom](/docs/non-shopify-installation) guide.

<Info>
  **Headless storefront?** Use this guide too. Only [step 1](#1-install-the-northbeam-pixel-and-metadata-script) is different. Pick the **Headless storefront** tab there. Steps 2 to 5 are the same, because checkout still runs on Shopify.
</Info>

## What you'll set up

| Step | What it tracks | Needed? |
| :- | :- | :- |
| [1. Add the pixel to your storefront](#1-install-the-northbeam-pixel-and-metadata-script) | Visits and page views on your storefront | **Required**. Headless stores: use the Headless tab. |
| [2. Add the Custom Pixel](#2-set-up-the-northbeam-custom-pixel) | Checkout pages and purchases | **Required** |
| [3. Turn on the App Pixel](#3-set-the-northbeam-app-pixel-to-always-on) | Data from Northbeam's Shopify app | **Required** |
| [4. Add the post-purchase script](#4-add-post-purchase-tracking-optional) | Post-purchase upsell pages | Only if you use a post-purchase upsell |
| [5. Let Northbeam know](#5-let-northbeam-know) | We finish your setup | **Required** |

<span id="where-to-find-your-northbeam-scripts" style={{ display: "block", scrollMarginTop: "7rem" }} />

## Before you start

* **Connect Shopify to Northbeam.** Step 3 needs it. If you haven't yet, follow the [Shopify Order Sync guide](/docs/shopify-order-sync) first.
* **Open your scripts.** Go to [Settings → Northbeam Pixel and Event Tracking](https://dashboard.northbeam.io/settings/tracking-script-tags). Every script in this guide is there, already filled in with your Client ID:

| Script in your dashboard | Where it goes | Step |
| :- | :- | :- |
| **Northbeam Pixel** | `<head>` of your storefront | [1](#1-install-the-northbeam-pixel-and-metadata-script) |
| **Metadata Script** | `<head>` of your storefront, above the pixel | [1](#1-install-the-northbeam-pixel-and-metadata-script) |
| **firePurchaseEvent** | Shopify **Customer events** (as a Custom Pixel) | [2](#2-set-up-the-northbeam-custom-pixel) |
| **Post-purchase upsell page** | Shopify **Settings → Checkout**. Optional. | [4](#4-add-post-purchase-tracking-optional) |

***

## 1. Install the Northbeam Pixel and Metadata Script

These scripts run on every page of your storefront. The **Northbeam Pixel** records visits, where visitors came from, and the pages they view. The **Metadata Script** records your store's region and currency.

Where they go depends on your storefront:

<Tabs>
  <Tab title="Standard Shopify theme">
    <Steps>
      <Step title="Open your theme code">
        In Shopify, go to **Online Store → Themes**. Click **⋮ → Edit code**.

        <Frame>
          <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/680fa0a8-edit-code-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=63a96066835036f0c11e64f9baa34091" alt="The ⋮ menu next to your current theme, with Edit code highlighted" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="850" height="300" data-path="images/readme/680fa0a8-edit-code-crop.png" />
        </Frame>
      </Step>

      <Step title="Paste both scripts in the head">
        Open **Layout → theme.liquid** and find the `<head>` section. Paste the **Metadata Script** first, then the **Northbeam Pixel** directly below it.

        <Frame>
          <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/a9a5aea3-theme-liquid-head-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=5d1e554e23360008c0e08194e402d2b0" alt="Metadata Script and Northbeam Pixel pasted at the top of the head section in theme.liquid" width="1558" height="312" data-path="images/readme/a9a5aea3-theme-liquid-head-crop.png" />
        </Frame>
      </Step>

      <Step title="Save">
        Click **Save**.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Headless storefront">
    A headless storefront doesn't use `theme.liquid`. Add the scripts to your storefront's own code instead.

    <Steps>
      <Step title="Paste both scripts in the head of every page">
        Add the **Metadata Script** first, then the **Northbeam Pixel** directly below it, in the `<head>` of every page on your storefront. You can do this in your site's code or through Google Tag Manager. See [Custom, step 1](/docs/non-shopify-installation#1-install-the-northbeam-pixel) for how.
      </Step>

      <Step title="Publish">
        Deploy your storefront, or publish your Google Tag Manager container.
      </Step>
    </Steps>

    <Note>
      **Is your storefront a single-page app?** Some headless storefronts change pages without a full reload (for example, Hydrogen). If yours does, the pixel only records the first page view. Also set up [Page View Events](/docs/page-view-events) to track the rest.

      Not sure? Ask your developer. Many headless storefronts aren't single-page apps and don't need this.
    </Note>

    Steps 2 to 5 below are the same for headless stores, because checkout still runs on Shopify.
  </Tab>
</Tabs>

***

<span id="customer-event-installation" style={{ display: "block", scrollMarginTop: "7rem" }} />

## 2. Set up the Northbeam Custom Pixel

Shopify's checkout doesn't run your theme, so the pixel from step 1 can't see it. The Custom Pixel covers checkout instead. It records the checkout pages customers view and **tracks completed purchases** using Shopify's `checkout_completed` event.

<Steps>
  <Step title="Add a custom pixel">
    In Shopify, go to **Settings → Customer events**. Open the **Custom pixels** tab and click **Add custom pixel**.

    <Frame>
      <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/596d5172-add_custom_pixel-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=7e7ef92d82e11d0f87bf01248b3b7849" alt="Customer events, Custom pixels tab, and the Add custom pixel button" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="940" height="610" data-path="images/readme/596d5172-add_custom_pixel-crop.png" />
    </Frame>
  </Step>

  <Step title="Name it">
    Name the pixel **Northbeam Event Tracking**, then click **Add pixel**.

    <Frame>
      <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/e8115547-name_it_add_pixel-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=2040990fa80624784710e365bb85ac68" alt="Naming the custom pixel" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="568" height="325" data-path="images/readme/e8115547-name_it_add_pixel-crop.png" />
    </Frame>
  </Step>

  <Step title="Set permission and paste the script">
    Set **Permission** to **Data collected does not qualify as data sale**. Paste the **firePurchaseEvent** script from Northbeam into the code editor, then click **Save**.

    <Frame>
      <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/1f436b37-data_sale_paste_script_save_-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=ff2e6c573465dce4c4b7978a3cc94d9c" alt="Setting the permission, pasting the script, and saving" style={{ maxWidth: "560px", maxHeight: "620px", width: "auto", height: "auto", margin: "0 auto" }} width="650" height="933" data-path="images/readme/1f436b37-data_sale_paste_script_save_-crop.png" />
    </Frame>
  </Step>

  <Step title="Connect it">
    Click **Connect**, then click **Connect** again to confirm.

    <Frame>
      <img src="https://mintcdn.com/northbeam/lFRUaEN9QqdoKEgD/images/readme/0ffb3783-CleanShot_2026-05-15_at_10.07.13.png?fit=max&auto=format&n=lFRUaEN9QqdoKEgD&q=85&s=188d32da230dd9585aee32e051a8fe1e" alt="Connect button for the custom pixel" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="960" height="389" data-path="images/readme/0ffb3783-CleanShot_2026-05-15_at_10.07.13.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/northbeam/lFRUaEN9QqdoKEgD/images/readme/687620ea-CleanShot_2026-05-15_at_09.23.03.png?fit=max&auto=format&n=lFRUaEN9QqdoKEgD&q=85&s=4ac5be622ca5ed74858fa7980d88e44d" alt="Confirming the pixel connection" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="821" height="323" data-path="images/readme/687620ea-CleanShot_2026-05-15_at_09.23.03.png" />
    </Frame>
  </Step>

  <Step title="Check your cookie banner">
    Go to **Settings → Customer privacy** and confirm a cookie consent banner is turned on. Without one, customers can't opt in to tracking, and the Custom Pixel may not run.

    <Frame>
      <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/26472f0f-privacy_policy-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=6d6e0496da7cb60e9a3a340e9b21eb81" alt="Shopify Customer Privacy settings" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="955" height="700" data-path="images/readme/26472f0f-privacy_policy-crop.png" />
    </Frame>
  </Step>
</Steps>

<span id="confirm-your-customer-privacy-settings" style={{ display: "block", scrollMarginTop: "7rem" }} />

***

## 3. Set the Northbeam App Pixel to Always on

The App Pixel was added to Shopify automatically when you connected your store. You don't need to create it or paste anything. Just change one setting.

<Steps>
  <Step title="Find the Northbeam App Pixel">
    In Shopify, go to **Settings → Customer events** and open the **App pixels** tab. Click **Northbeam**.

    <Frame>
      <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/a4f54544-CleanShot_2026-09-21_at_11.46.30-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=bd67f7cde6b452d1ccf3f7d8f8527961" alt="Northbeam listed under App pixels" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="682" height="560" data-path="images/readme/a4f54544-CleanShot_2026-09-21_at_11.46.30-crop.png" />
    </Frame>
  </Step>

  <Step title="Turn on Always on">
    Select **Always on**, then click **Apply**.

    <Frame>
      <img src="https://mintcdn.com/northbeam/lFRUaEN9QqdoKEgD/images/readme/8295d273-CleanShot_2026-09-21_at_11.48.01.png?fit=max&auto=format&n=lFRUaEN9QqdoKEgD&q=85&s=32a6320896423f81dd49f66e5743ed9c" alt="Always on data access setting for the Northbeam App Pixel" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="670" height="546" data-path="images/readme/8295d273-CleanShot_2026-09-21_at_11.48.01.png" />
    </Frame>
  </Step>
</Steps>

<Tip>
  **Don't see Northbeam under App pixels?** Your store isn't connected yet. Follow the [Shopify Order Sync guide](/docs/shopify-order-sync).
</Tip>

***

## 4. Add post-purchase tracking (optional)

**Skip this step** unless your store shows a post-purchase upsell page after checkout. This script lets Northbeam attribute those extra purchases.

<Steps>
  <Step title="Open checkout settings">
    In Shopify, go to **Settings → Checkout**.

    <Frame>
      <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/4512c78e-CleanShot_2026-05-15_at_10.11.07-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=c9fb090b3368771aaea5281bcfe65252" alt="Shopify Checkout settings" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="940" height="370" data-path="images/readme/4512c78e-CleanShot_2026-05-15_at_10.11.07-crop.png" />
    </Frame>
  </Step>

  <Step title="Paste the post-purchase script">
    Scroll to **Post-purchase page**. Paste the Northbeam post-purchase script into **Additional scripts**, then click **Save**.

    <Frame>
      <img src="https://mintcdn.com/northbeam/J4zmt1vvYYrNiG2R/images/readme/bef4c22c-CleanShot_2026-05-15_at_10.11.24-crop.png?fit=max&auto=format&n=J4zmt1vvYYrNiG2R&q=85&s=0de1198aba9778ecd7c0c362847bc9a6" alt="Additional Scripts field on the Post-Purchase Page" style={{ maxWidth: "560px", maxHeight: "440px", width: "auto", height: "auto", margin: "0 auto" }} width="655" height="285" data-path="images/readme/bef4c22c-CleanShot_2026-05-15_at_10.11.24-crop.png" />
    </Frame>
  </Step>
</Steps>

***

<span id="step-5-notify-northbeam" style={{ display: "block", scrollMarginTop: "7rem" }} />

## 5. Let Northbeam know

When your scripts are installed, [submit a support ticket](https://www.northbeam.io/submit-a-support-ticket) to tell our team. We'll finish your setup so page views are tracked correctly.

<Warning>
  **Don't skip this step.** If we don't hear from you, page view tracking may be incorrect. Page views are the foundation of Northbeam's tracking, so attribution can be incomplete without them.
</Warning>

***

<span id="confirm-your-setup" style={{ display: "block", scrollMarginTop: "7rem" }} />

## Test your setup

Check that you have:

* The **Metadata Script** and **Northbeam Pixel** in the `<head>` of your storefront, in that order (in `theme.liquid` for standard themes)
* The **Northbeam Custom Pixel** connected under **Customer events → Custom pixels**
* The **Northbeam App Pixel** set to **Always on** under **Customer events → App pixels**
* The **post-purchase script** in your checkout settings (only if you use a post-purchase upsell)

Then [test that the pixel is firing](/docs/add-pixel#how-to-test-for-the-northbeam-pixel).

## Optional tracking

Add these only if they apply to your store.

<CardGroup cols={2}>
  <Card title="Custom Goals" icon="bullseye" href="/docs/setting-up-custom-goals">
    Track other actions, like sign-ups, add-to-carts, or form submissions.
  </Card>

  <Card title="Page View Events" icon="eye" href="/docs/page-view-events">
    Only for headless storefronts that are single-page apps (for example, Hydrogen). Most stores don't need this.
  </Card>
</CardGroup>

<span id="frequently-asked-questions" style={{ display: "block", scrollMarginTop: "7rem" }} />

<span id="why-are-there-two-northbeam-pixels-in-shopify" style={{ display: "block", scrollMarginTop: "7rem" }} />

## FAQ

<AccordionGroup>
  <Accordion title="Why are there two Northbeam pixels in Shopify?">
    After setup, you'll see **two Northbeam entries** under **Settings → Customer events**. This is expected. They're not duplicates, and **you need both**.

    | Pixel | Where it appears | How it's added |
    | :- | :- | :- |
    | **Custom Pixel** | Customer events → **Custom pixels** | You create it in step 2 |
    | **App Pixel** | Customer events → **App pixels** | Added automatically when you connect Shopify |

    Don't delete either one.
  </Accordion>

  <Accordion title="What if I only see one Northbeam pixel?">
    Check both tabs under **Settings → Customer events**.

    * **Custom Pixel missing:** complete [step 2](#2-set-up-the-northbeam-custom-pixel).
    * **App Pixel missing:** connect your store using the [Shopify Order Sync guide](/docs/shopify-order-sync).
  </Accordion>

  <Accordion title="What if my checkout is on Shopify but my backend is custom?">
    For example, an external order management system sends your orders to Northbeam through the [Orders API](/docs/orders-api) instead of the Shopify connector. Follow this guide as normal, but change one line in the Custom Pixel. See [Shopify + Custom](/docs/shopify-custom-backend).
  </Accordion>

  <Accordion title="Can I install Northbeam through Google Tag Manager?">
    **Standard Shopify themes:** no. Install the scripts directly in Shopify using the steps above.

    **Headless storefronts:** you can add the Northbeam Pixel to your storefront through Google Tag Manager (see the Headless tab in step 1). Steps 2 to 4 are always done in Shopify.
  </Accordion>
</AccordionGroup>
