Add Sumly to a Shopify store
The line goes into your theme's layout, theme.liquid, just before the head closes. A few more lines let Shopify's own cookie banner tell Sumly when a visitor agrees.
Step by step
- 1
In Sumly, open Visitors and copy your project's line.
- 2
In Shopify, open Online Store › Themes, duplicate your theme as a backup, then open the menu next to it and Edit code.
- 3
In layout/theme.liquid, paste the line just before
</head>, with the consent lines below it if your store shows Shopify's cookie banner. Save, and open your store: the visit shows on Visitors.
Just before </head>.
<script defer src="https://sumly.dev/s.js" data-site="sl_your_key"></script>
Or let your coding assistant do it
Paste this into Claude Code, Cursor or Codex in your project. It fits the code to how your project is built, asks you for the dashboard steps and leaves the keys to you.
See what it says
Set up Shopify for Sumly in this project.
Sumly (https://sumly.dev) shows revenue next to the visits and app users it came from. The full guide is https://sumly.dev/install/shopify; read it if anything below is unclear.
Steps:
1. In Sumly, open Visitors and copy your project's line.
2. In Shopify, open Online Store › Themes, duplicate your theme as a backup, then open the menu next to it and Edit code.
3. In layout/theme.liquid, paste the line just before `</head>`, with the consent lines into Sumly it if your store shows Shopify's cookie banner. Save, and open your store: the visit shows on Visitors.
theme.liquid: Just before </head>.
```
<script defer src="https://sumly.dev/s.js" data-site="sl_your_key"></script>
```
Consent: With Shopify's cookie banner (Settings › Customer privacy): Sumly sets its cookie once the visitor allows analytics. Shopify asks first only where your privacy settings say so.
```
<script>
window.Shopify.loadFeatures([{ name: 'consent-tracking-api', version: '0.2' }], function (error) {
if (error) return;
var tell = function () { window.sumly && sumly.consent(window.Shopify.customerPrivacy.analyticsProcessingAllowed()); };
tell();
document.addEventListener('visitorConsentCollected', tell);
});
</script>
```
Keep in mind: You can edit a theme's code only once the theme is bought, not during a paid theme's trial. A theme update made by Shopify can drop code changes. After updating, check theme.liquid still has the line.
How to work:
- Look at how this project is built first, and fit the code to its framework and its way of doing things; the examples above are a starting point, not something to paste as is.
- Steps that happen in a dashboard (Sumly, or Shopify's own) are mine: tell me exactly what to click, then wait for me.
- Keys the code needs belong in environment variables, never in the code or the repository. Never ask me to paste a secret key into this chat; tell me which variable to set.
- Change only what this needs, show me the changes before you commit, and tell me how to check that it works.
- sl_your_key stands for the project's public key; it is on the Visitors page in Sumly. Ask me for it.
Consent
Shopify's cookie banner covers Shopify's own tools; a line you add yourself has to ask it. The consent lines above do that through Shopify's Customer Privacy API: Sumly counts every visit, and sets its cookie only once the visitor allows analytics.
Checkout
Theme code does not run on Shopify's checkout, so the line cannot carry the visitor there itself. Sumly reads your orders through a read-only app, and a snippet in theme.liquid puts the visitor on the cart, which Shopify copies onto the order: each order then counts for the visit that bought. Both are on the Shopify page.
Your own domain
On Starter and Growth, one DNS record serves the script from your own address, past ad blockers: under Visitors › Add tracking › Your own address, enter one such as signal.your-site.com and add the CNAME it shows. If your checkout or app is on another domain, add it under Projects and payments › Other domains: the line then carries data-domains and one person stays one visitor across them.
Clicks and sections
Clicks on links to other sites count by themselves. Mark a button with data-sumly-event="signup" to count its clicks, and a section with data-sumly-scroll="pricing" to count the page views that reached it, a goal such as reached pricing.
Good to know
- You can edit a theme's code only once the theme is bought, not during a paid theme's trial.
- A theme update made by Shopify can drop code changes. After updating, check theme.liquid still has the line.
From Shopify's own documentation, checked 4 November 2026: help.shopify.com/en/manual/online-store/themes/theme-structure/extend/edit-theme-code, shopify.dev/docs/api/customer-privacy, help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings .
Other platforms
Try it with your own projects
Sign in with Google or a code by e-mail and connect your first project. Free for one project, and 14 days of a paid plan with no card.
Start freeOr look around first: open the live demo.