Install Muro on Shopify
Add the Muro script to your Shopify theme for storefront pageviews, and the Muro pixel for carts, checkouts and purchases.
A Shopify store needs two pieces. The tracking script in your theme records storefront pageviews. The Muro pixel records add-to-cart, checkout and purchase events, because Shopify's checkout and thank-you pages never run theme code. Both work on every plan.
Muro walks you through both in Settings → Integrations → Shopify, a checklist whose steps turn green on their own as events arrive. The Use the Shopify setup link on the install screens takes you there.
Steps
Add the tracking script to your theme
-
In Muro, open Settings → Integrations → Shopify and click Copy script in step 1, "Add the tracking script".
-
In Shopify admin, go to Online Store → Themes, click ⋯ next to your live theme, then Edit code.
-
Open
layout/theme.liquid. -
Paste the snippet just before the closing
</head>tag:<script async src="https://api.muroanalytics.com/muro.js" data-project-id="YOUR_PROJECT_ID"></script> </head> -
Click Save.
Add the Muro pixel
- In Muro, in step 2, "Add the Muro pixel", click Copy pixel code.
- In Shopify admin, go to Settings → Customer events and click Add custom pixel.
- Name it Muro and paste the code into the code editor.
- Choose a Customer privacy setting (see below).
- Click Save, then Connect.
You paste the pixel once. Updates to it ship from Muro automatically, so you never need to paste it again. Don't paste the pixel into theme.liquid.
The pixel sends add_to_cart, checkout_started and purchase as custom events, once per checkout. It remembers where the shopper first came from for 30 days, so a purchase is credited to the right source. It never reads customer details such as email, phone, names or addresses.
Connect orders for exact revenue (optional)
The pixel counts purchases. To see exact revenue by source, campaign and landing page, connect your orders in step 3, "Connect orders for exact revenue". This needs the Team plan or a trial. See Connect Shopify revenue.
Choosing the customer privacy setting
Shopify asks how the pixel should treat visitor consent. Muro doesn't choose for you:
- Not required matches how the Muro script already runs: cookieless, without a consent banner. Carts, checkouts and purchases are recorded without waiting for consent.
- Analytics makes the pixel wait for each visitor's consent. Visitors who never accept your banner aren't tracked at checkout, so fewer orders can be tied to a source. Without consent, the pixel only remembers the source for the current session.
This isn't legal advice. If you're unsure, check what your store's privacy policy promises.
Verify it works
- Open your storefront in a browser.
- In Muro, step 1 turns green with "Pageviews are arriving." once the first pageview lands. You can also check DevTools: in the Network tab, filter by
collectand reload. You should see aPOSTtocdn.muroanalytics.com/collectwith status202. - Add a product to your cart. Step 2 turns green with "Cart, checkout and purchase events are arriving."
- Or set the dashboard time picker to Live. Your visit appears within about 30 seconds, and the cart event shows in the Custom Events panel.
Good to know
- Password-protected stores. The password page doesn't load
theme.liquid, so no pageview arrives from it. Test after removing the password, or after entering it to get past the password page. - Switching themes. The script lives in one theme's
theme.liquid. If you publish a different theme, paste the script into that theme too. The pixel isn't tied to a theme. - Revenue stays in the app. Revenue figures show on your dashboard's Revenue panel. They aren't included in the daily digest, Slack or insights.