Ecommerce platforms
Shopify analytics with CrispStats
To add CrispStats to a Shopify store, paste the script tag above the closing head tag in your theme's layout/theme.liquid file. That covers the storefront pages. Then connect the store in **Settings**, **Integrations** with the client ID and secret of a small app you create for it, and every paid order and refund counts as verified revenue, tied to the visit that led to it.
Updated
Set up CrispStats on Shopify
- 01
Step 1: Copy the Shopify snippet
In the CrispStats dashboard, open your site’s Settings, select Tracking code and choose the Shopify tab. It has your public key and your store’s domain filled in.
- 02
Step 2: Open the theme code editor
In your Shopify admin, go to Online Store, then Themes. On your current theme, open the actions menu (the horizontal dots) and choose Edit code.
- 03
Step 3: Paste the tag above the closing head tag
Under Layout, open
theme.liquid. Find</head>and paste the script on the line above it, then save the file.Replace the highlighted values with your own.
layout/theme.liquid<scriptdeferdata-site="cs_pk_your_site_key"data-domains="example.com"src="https:/ / in. crispstats. com/ d. js"></script></head> - 04
Step 4: Tag store actions (optional)
Add
data-cs-eventto a button in your theme templates to count it as a custom event, with properties fromdata-cs-prop-attributes. No JavaScript is needed.<button data-cs-event="add to cart" data-cs-prop-sku="tee-01">Add to cart</button> - 05
Step 5: Connect the store
In Settings, Integrations, choose Connect a payment provider, then Shopify. Enter the store’s myshopify.com address, create an app for the store in Shopify’s Dev Dashboard with
read_ordersandread_all_orders, install it, and paste its Client ID and Client secret. CrispStats imports past orders and creates its own webhooks for paid orders and refunds. See Shopify revenue for each step. - 06
Step 6: Save the visitor id on the cart
The script does not run on Shopify’s checkout pages, so the visitor id travels on the cart. Paste this below the script tag in
theme.liquid. It does nothing when the visitor declined analytics in your store’s cookie banner.layout/theme.liquid{% if cart.item_count > 0 %}<script>window.addEventListener( "load", async function () {var privacy = window.Shopify && window. Shopify. customerPrivacy;if (privacy && privacy. analyticsProcessingAllowed && !privacy. analyticsProcessingAllowed( )) return;var id = await window. crispstats? . id( );if (!id) return;fetch( window. Shopify. routes. root + "cart/update.js", {method: "POST",headers: { "Content-Type": "application/json" },body: JSON.stringify({ attributes: { __crispstats_vid: id } }),});});</script>{% endif %}
Check that it works
Open your live storefront in a browser. The status row on the CrispStats Tracking code tab shows Receiving events. once the first event is stored, and the visit appears on the Realtime screen within a few seconds. Once the store is connected, a paid order appears under Payments on the Revenue screen with the source of that visit.
CrispStats on Shopify
What you get
- Visitors, pageviews and sessions for the storefront pages that use
theme.liquid: home, collections, products, cart and content pages. - Which channels bring shoppers: search, social, email and ad campaigns tagged with UTM parameters, and AI assistants such as ChatGPT and Perplexity.
- Funnels from a product page to the cart, built from page paths or your own events, calculated over data you already have.
- Revenue per source and campaign for every paid order, read back from Shopify’s Admin API so it counts as verified, credited to the first touch known for the visitor, with refunds as negative payments.
- Countries, devices and browsers, with no cookies and no IP addresses stored.
- Visitors, pageviews and sessions for the storefront pages that use
Notes and limits
- Shopify sends each paid order within seconds, and CrispStats checks every 15 minutes for anything the webhook missed. With
read_all_ordersthe import reads every order since your first, otherwise the last 60 days. - Shopify’s checkout and order status pages do not use
theme.liquid, so the script does not run there. The cart attribute carries the visitor id into the order instead. - Shopify does not mark renewal orders, so every order is recorded as a one-time payment. Test orders show with a Test tag and are kept out of revenue and every total.
- An order without the cart attribute is still recorded and counted, without a visit: it is left out of the source and campaign breakdowns.
- If you report Shopify orders yourself through the payment API, stop when you connect Shopify. Those payments are stored under a different provider, so each order would count twice.
- The tag lives in one theme. If you switch themes, or publish a new copy of the theme, add the tag and the cart snippet to that theme’s
theme.liquidtoo. - There are no product-level ecommerce reports: no inventory, margins or product performance. Shopify stays the source of truth for orders.
- Shopify sends each paid order within seconds, and CrispStats checks every 15 minutes for anything the webhook missed. With
The docs page covers the optional steps this guide leaves out.
Setup questions. Straight answers.
What people ask before they connect it.
There is no app to install from the Shopify App Store. CrispStats is one script tag in your theme, and you connect the store's orders with the client ID and secret of a small app you create for your own store in Shopify's Dev Dashboard.
The script does not load there, because Shopify's checkout and order status pages do not render theme.liquid. The order still reaches the Revenue screen through the connected store, tied to the visit by the visitor id saved on the cart.
No. It answers a different question: which sources, campaigns and pages bring the visitors who buy. Keep Shopify for orders, inventory and product reports, which this does not have.
CrispStats sets no cookies and stores nothing on the shopper's device by default. Shopify itself sets cookies for the cart and checkout, and apps you install may add more, so the answer depends on the whole store. This is not legal advice.
Every feature is on every plan. Every account starts with a 14-day free trial with no card. Starter is $5 a month for 250,000 events and Growth is $12 for 1,000,000.
Not answered here? Write to hello@crispstats.com
Go further
Related
- Cookieless analytics for online stores
Tie orders to the campaign, page and source they came from, find where checkout loses people, and watch page speed, without cookies.
- Revenue attribution: which traffic pays
See which source, page and campaign each payment came from.
- Funnels and goals
Find the step where people leave, and count what matters.
- Revenue per visitor calculator
Enter visitors, conversion rate and average order value to get revenue per visitor, monthly revenue, and what a 10% improvement is worth.
Guides
- Shopify analytics explained: what each plan shows and where a second tool helps
What Shopify's built-in analytics shows on each plan, how it counts sessions and credits sales, and the gaps where a second analytics tool earns its place.
- The best marketing and revenue attribution tools for SaaS and indie makers
Twelve marketing attribution tools that tie payments to traffic sources, compared by payment providers read, price and limits.
Other integrations
Frameworks
Site builders
Tag managers
Your traffic, crisp and clear
One script, no cookies, and every feature from the first day. Set up takes about as long as pasting a snippet.