punchline!

Install

Install on Shopify

Three parts, each optional, that add up to the whole picture for a store:

Part What it adds Where
Cloudflare Worker Every request, including agents and crawlers that never run JavaScript Cloudflare, in front of your store
Browser snippet People, and agents working inside a browser Your theme
Order webhook Paid orders as purchases, tied to the visit, by people and by agents Shopify admin, no app

1. Agents: the Cloudflare Worker

Shopify serves your store, so the edge install is a Cloudflare Worker in front of it, through Cloudflare's Orange-to-Orange mode. It's the only part that sees agents fetching product pages without running JavaScript, and whether each one got the page. Shopify's domain settings may show a "Cloudflare proxy" warning even though the store works.

2. People: the browser snippet

In Shopify: Online Store → Themes → ⋯ → Edit code → layout/theme.liquid. Paste your snippet line (Site settings → Install) just before </head> and save. Under Site settings → Allowed hosts, list the store's hostnames. With the Worker in place too, page loads aren't counted twice.

Agents shopping your catalog

Every Shopify store serves a catalog to AI agents at /api/ucp/mcp (search, product lookups). With the Worker in front of the store, calls to it show under AI & agents → MCP: which tools agents call, how often, and which agent platform each comes from, read from the agent profile each call must carry (@punchline-analytics/cloudflare 0.6.0). Agents that call the store's myshopify.com address instead of your domain don't pass through the Worker, so they aren't seen.

3. Purchases: the order webhook

No app to install. Shopify sends each paid order to Punchline, which counts it as a purchase on the visit it came from: orders agents placed and orders people placed report separately.

  1. In Punchline: Site settings → Install → Shopify orders. Copy the webhook address. Keep it private: anyone with it can add purchases to the site.
  2. In Shopify: Settings → Notifications → Webhooks → Create webhook.
  3. Event: Order payment. Format: JSON. Webhook API version: the latest. URL: the address from step 1. Save.
  4. Place a test order, or wait for the next real one. It appears under Events as purchase within a minute.

What's kept per order: the total, the currency, the number of items, and the sales channel Shopify reports (like web or pos). Shopify sends the shopper's browser address and user agent with the order; Punchline uses them in memory to find the visit and its label, as for page views, then discards them. Names, emails and addresses in the order are never kept.

  • Each order counts once, however often Shopify retries.
  • Test orders (Shopify's test mode) are ignored.
  • Orders without browser details (point of sale, draft orders, orders created in the admin) are counted, but not tied to a visit.
  • The webhook's "Send test" button sends a sample order, which is counted like a real one. Use a test order instead.
  • Not seen: orders whose checkout happens on another platform's own pages and never reaches your store, such as some checkouts inside AI assistants. Where Shopify reports them, their sales channel says so.

Already using a Shopify app for webhooks? Any service that forwards Shopify's order JSON to the same address works the same way.

Ask the docs

Answers come from these docs only, written by Claude (Anthropic). Your question is sent to answer it, and isn't stored.