Skip to main content
To install CrispStats on Shopify, edit your theme’s layout/theme.liquid file and paste the script tag just above </head>. That file is the main layout of your theme, so one paste covers the storefront pages that use it. To record the store’s orders as revenue, connect Shopify in Settings, Integrations as described below.

Add the script

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 filled in:
layout/theme.liquid
2

Open the theme code editor

In your Shopify admin, go to Online Store, then Themes. On your current theme, open the actions menu and choose Edit code.
3

Paste the tag above head

Under Layout, open theme.liquid. Find the closing </head> tag and paste the script on the line above it:
layout/theme.liquid
Save the file.
4

Open your store

Open your live storefront in a browser. The status row on the CrispStats Tracking code tab shows Receiving events. once the first event has been stored.
The tag lives in your theme. If you switch to another theme, or publish a new copy of it, add the tag to that theme’s theme.liquid too.

Add optional modules

The switches under Extra events on the Tracking code tab add attributes to the tag. Copy the updated tag from the Shopify tab and replace the one in theme.liquid. For example, with outbound links and web vitals on:
layout/theme.liquid

Record revenue from a Shopify store

Connect the store in Settings, Revenue: choose Connect a payment provider, then Shopify, and paste the store’s myshopify.com address with the Client ID and Client secret of a small app you create for the store in Shopify’s Dev Dashboard. CrispStats reads each order back from Shopify’s Admin API, so it counts as verified revenue, imports the store’s past orders, and records new paid orders and refunds by webhook within seconds, with a check every 15 minutes for anything the webhook missed. Shopify’s checkout pages do not render theme.liquid, so the script from this guide does not load there. To tie each order to the visit that led to it, add a short snippet under the CrispStats tag that saves the visitor id on the cart. An order without it is still recorded and counted, without a visit. Shopify revenue walks through both steps.
If you already report Shopify orders yourself through the payment API, stop doing so when you connect Shopify. Those payments are stored under a different provider, so each order would count twice.
If you sell an app on the Shopify App Store rather than run a store, connect Shopify App Store instead: it records your app’s earnings from Shopify’s Partner API.

Next steps

Shopify revenue

Connect the store and tie each order to a visit.

Revenue overview

How CrispStats ties a payment to the visit that led to it.

Track custom events

Send add-to-cart and other store actions.
Last modified on November 24, 2026