Installation guides
Install on Shopify
Paste the script into your theme layout so every storefront page loads it.
Copy your snippet
In MetricRaven, open your site's Settings → Install card and copy the script tag. It already contains your site ID.
Open your theme code
In Shopify admin, open Online Store → Themes, choose the menu next to your live theme and select Edit code.
Paste it into layout/theme.liquid before </head>
Replace
YOUR_SITE_IDwith the public site ID from your site's Settings → Install card. The site ID is public and safe in browser code; never put your secret key in a page.layout/theme.liquid<script defer src="https://metricraven.com/js/script.js" data-site-id="YOUR_SITE_ID" ></script>Save and open your store
Open a storefront page on your store's domain.
Verify it works
Open your live website in a normal browser window (not an automated or embedded one). In the browser's Network panel, look for script.js and then a request to /api/v1/collect whose response contains ok: true. Open your site's Traffic tab and choose Refresh; the selected dates must include your visit.
Nothing showing? See Troubleshooting.
Notes
- The snippet runs where your theme's layout is used. Checkout and other pages that don't render
theme.liquidare not covered by it. - The code lives in that theme. If you publish a different theme, add the script there too.
- Only hostnames listed in your site's Settings → Site domains (and their subdomains) are accepted. To also count visits on a platform address such as
your-store.myshopify.com, add it there; otherwise those requests are refused withdomain_not_allowed. - Shopify orders are not imported automatically. You can send payments from your own backend with the Payments API.
- If you use a cookie banner, connect it with Consent & visitor IDs.
Optional script attributes are listed in Install & verify. To exclude your own visits, see Exclude your visits.