> AI agents: this is one page of nextanalytica's docs. The full index for agents: https://nextanalytica.app/llms.txt

# Shopify analytics

> Add analytics to Shopify: install, events, consent and AI crawlers, counted without cookies until a yes and read by your agent.

Updated: 2026-12-01

To add analytics to a Shopify site, add nextanalytica's tag line once, so it runs on every page; the steps for Shopify are below. It counts visits, where they came from and what they led to, without cookies until a visitor agrees, and your agent (Claude, Cursor, Codex) reads the numbers over MCP.

> **Tip:** Connected agents do this for you: ask "Add nextanalytica to my Shopify site". It calls `get_tag`, shows you the change and asks before committing.

## How do you add nextanalytica to Shopify?

In Shopify: Online Store → Themes → Edit code → theme.liquid. Paste the tag line before </head>, save. For paid orders by channel, connect Shopify in Connections.

```html
<script async src="https://t.nextanalytica.app/t.js" data-project="na_…"></script>
```

Copy the line with your project's key from **Site**: `na_…` is that key. Never make one up: a line written from memory counts nothing.

## How do you send events?

Send the actions that matter, such as a sign-up, from a script on the page:

```js
window.nextanalytica?.track("signup_completed", { plan: "team" });
```

Mark the events that count as conversions, and your agent reads conversion rates by channel and page. See [Custom events](/docs/tracking/custom-events).

## How does consent work?

The tag counts without cookies until the visitor answers your banner, so people who never click it are still counted. Pass the answer on every page:

```js
window.nextanalytica?.consent(true); // or false
```

A yes starts a first-party id; a no stops the tag sending and removes what it kept. More in [Cookieless counting and consent](/docs/tracking/cookieless-and-consent).

## How do you record orders?

Install the nextanalytica app from [the Shopify source](/docs/sources/shopify): it adds the tag to every page, watches the checkout with a Shopify pixel, and copies your paid orders every hour, each with the visit it came from.

## Can you see AI crawlers?

AI crawlers such as GPTBot and ChatGPT-User never run the tag. A sender on your server passes their hits, so your agent sees which pages AI assistants read and which visits followed.

- **Shopify behind Cloudflare:** a Cloudflare Worker in front of the site passes the hits.

See [AI crawlers](/docs/tracking/ai-crawlers) for the setup, and [AI traffic analytics](/docs/tracking/ai-traffic) for what you get.

## How do you check it works?

Ask your agent "Check my nextanalytica setup": `check_setup` lists the hosts that sent something and what to do next. Then ask:

- "How many visits did we have this week, and from where?"
- "Which pages do people land on from Google and from ChatGPT?"
- "Which channel brings sign-ups?"

## Next steps

- [Add the tag](/docs/tracking/installation)
- [Custom events](/docs/tracking/custom-events)
- [How to track website traffic](/docs/learn/track-website-traffic)

Canonical address: https://nextanalytica.app/docs/platforms/shopify
