Shopify

A snippet today. First-party if you want it.

Shopify will not let a theme rewrite /cf.js on the shop hostname. A WordPress-style plugin cannot exist here. What we can automate is the snippet. First-party is a subdomain, or a custom app proxy for people who will click through Partners once.

Non-technical — start counting

  1. Add the shop in Cookie Free Analytics. Choose Shopify.
  2. Download the theme snippet (site ID is already inside).
  3. Online Store → Themes → ⋯ → Edit code.
  4. Under Snippets, Add a new snippet named cookiefree. Paste the file. Save.
  5. Open Layout / theme.liquid. Just above </body> add {% render 'cookiefree' %}. Save.

That is enough to record pageviews. Lists that block our hostname can still drop some visits. The next step is first-party.

First-party, no app — CNAME

Add c.yourshop.com as a CNAME in the DNS that owns the domain (often Cloudflare or the registrar — not the Shopify admin). Point it at Cookie Free Analytics, leave Cloudflare’s orange cloud on, then Check now. Change the snippet src to https://c.yourshop.com/cf.js when the check is green — Cookie Free Analytics does that in the dashboard snippet if you saved the subdomain.

First-party, technical — app proxy

A custom Shopify app can expose /apps/cookiefree/cf.js on the shop hostname. That is first-party without a new subdomain.

  1. Create a custom app in the Shopify Partners dashboard (or the shop’s Dev Dashboard).
  2. App proxy: subpath prefix apps/cookiefree, proxy URL https://YOUR-COOKIEFREE-HOST/shopify/proxy.
  3. Point the snippet at /apps/cookiefree/cf.js.
  4. In Cookie Free Analytics, save Shopify as the path proxy and Check now.

We already serve that proxy. Collect through it only counts when Shopify signed the query (signature or hmac). Set SHOPIFY_API_SECRET to the app’s client secret. Unsigned POSTs return 204 — the path is not a second public collect. The theme snippet that posts to /api/collect is unchanged. A public App Store listing still needs a Partner account, review, and OAuth — that is the remaining product work, not something a zip file can skip. The theme snippet covers everyone today.

WordPress plugin · Every host