Install Linqry on Shopify
To add Linqry to a Shopify store, edit your theme's code and paste the two-line snippet just before `</head>` in `layout/theme.liquid`. That covers your storefront: home, collections, products, cart and content pages. Checkout pages don't use your theme, so the snippet doesn't run there.
Updated · 3 min read
Install in theme.liquid
- Add your store's domain to Linqry
Start a free trial, add your store's custom domain and copy the snippet from the Install page.
- Duplicate your theme
Shopify recommends duplicating a theme before editing its code, so you can go back if anything goes wrong. Note that edits can be dropped when you later update the theme, so keep a copy of the snippet.
- Open the code editor
In your Shopify admin, go to Online Store, click the menu icon next to your theme and select Edit code.
- Paste the snippet before </head> in layout/theme.liquid
theme.liquidis the default layout every template uses. Paste the snippet inside<head>, for example just before</head>, and leave Shopify's{{ content_for_header }}exactly as it is. Save.<!-- layout/theme.liquid --> <head> ... {{ content_for_header }} <script>window.linqry=window.linqry||function(){(window.linqry.q=window.linqry.q||[]).push(arguments)}</script> <script defer data-website-id="YOUR_SITE_ID" data-domain="yourdomain.com" src="https://linqry.com/t.js"></script> </head> - Check Realtime
Open the store in a private window, view a collection and a product, then open Realtime in Linqry. Each page shows up in the live event stream.
What theme code can and can't track
| Area | Tracked by the snippet? | Why |
|---|---|---|
| Home, collections, products, search, blog, pages | Yes | They render through theme.liquid. |
| Cart page | Yes | Part of the theme. |
| Checkout steps | No | Checkout uses its own layout, which isn't your theme. Customizing it is limited to Shopify Plus, and checkout.liquid is deprecated. |
| Thank you and order status pages | No | Also outside the theme; checkout.liquid was sunset for these pages. |
| Templates with an alternate layout (for example a password page) | Only if that layout also has the snippet | Each layout file has its own <head>. |
In practice that means Linqry shows how shoppers find you and move through the store, up to the moment they start checkout. To measure completed purchases, record them on the server, below.
Track product interest in the storefront
Add data-linqry-event attributes in your theme's Liquid to buttons you care about. Liquid can fill in properties, so you can see which products get attention:
<button type="submit" name="add"
data-linqry-event="add-to-cart"
data-linqry-event-product="{{ product.handle }}">
Add to cart
</button>That's a click, not a guaranteed cart addition (a sold-out variant can still be clicked), but it's a useful signal. Put add-to-cart in a funnel after a product page view to see the same-day drop-off, and see custom events for limits on names and properties.
Record paid orders from a webhook
Shopify can send a webhook when an order is paid: in your admin, go to Settings → Notifications → Webhooks and create one for the Order payment event in JSON. Shopify can't attach Linqry's write key to that request, so point the webhook at a small function you run (a serverless function is enough). It should check Shopify's signature, then send a revenue event to Linqry's tracking API with the site's write key, which is shown on the Install page to owners and admins.
curl -X POST https://linqry.com/api/track \
-H "Authorization: Bearer YOUR_WRITE_KEY" \
-H "Content-Type: application/json" \
-d '{
"siteId": "YOUR_SITE_ID",
"event": "purchase",
"url": "https://yourdomain.com/checkout",
"properties": { "order": "1042" },
"revenue": 4900
}'Revenue is in cents. A server-side event carries exactly the url and referrer you send and nothing more, so it isn't joined to the shopper's browsing automatically. The server-side revenue tracking guide and the revenue docs cover the options for attributing these sales.
Domains and your own visits
Register the custom domain shoppers use. If the store can also be reached on its original Shopify-provided address, either leave that out or add it under Additional hosts in site Settings. To keep your own browsing out of the stats, open the store, open the browser console and run:
localStorage.setItem('linqry_ignore', 'true')Troubleshooting
- Nothing in Realtime? Make sure you edited the published theme, not a duplicate, and that you're browsing the registered domain.
- Snippet vanished after a theme update? Updates can drop code edits. Paste it into
theme.liquidagain. - Store has a consent banner? The tracker sets no cookies and stores nothing in the browser, and raw IP addresses are never stored. Whether your store needs consent, for Linqry or other tools, is a question for you and your advisor.
Frequently asked questions
Is there a Linqry app in the Shopify App Store?
No. Linqry is installed with the theme snippet, plus an optional webhook relay for orders. There's no app to install.
Can Linqry track the checkout funnel step by step?
No. Shopify doesn't run theme code on checkout pages, so the steps between starting checkout and paying aren't visible to the snippet. You can track everything before checkout and record paid orders from the server.
Do I need to edit code on every theme?
Only on the theme that's published. If you switch themes, add the snippet to the new theme's theme.liquid before publishing it.
Sources
- Shopify Help Center: Editing theme code (checked Nov 9, 2026)
- Shopify Dev: Theme layouts (theme.liquid, checkout layout) (checked Nov 9, 2026)
- Shopify Help Center: Webhooks (checked Nov 9, 2026)
Related
Linqry shows an online store which channels, campaigns and countries bring buyers, not just visits, and where shoppers drop out between product page and purchase. It's cookieless analytics with revenue attribution, funnels and campaign links, at $5 per site per month.
Attach revenue to events from the browser or your backend and see revenue and conversion by referrer, UTM source and country, plus revenue by device, OS and browser.
Attach an amount to any event, from the browser or your backend, and see revenue by source, campaign, country and device.
Server-side conversion tracking means your backend, not the visitor's browser, reports that a payment happened. You send the event from the place where money is confirmed, usually a payment webhook, so the number in your analytics matches your billing system and can't be faked from the browser console.
Start measuring your Shopify site
No card required · 30-day trial · No cookies