All installation guides
Add the one-line Muro snippet to your site, find the guide for your platform, and check that events are arriving.
Muro is one <script> tag. Paste it into the <head> of every page and Muro starts recording pageviews, referrers, UTM campaigns, devices and locations. This page covers what the snippet is, where it goes, and links to a guide for each platform.
The snippet
<script async src="https://api.muroanalytics.com/muro.js" data-project-id="YOUR_PROJECT_ID"></script>You don't need to type your project ID. Copy the snippet with your ID already filled in from either place:
- Settings → Project → Tracking script → Copy script
- Step 2 of onboarding, "Add this snippet to your site" → Copy snippet
The script is under 2 KB gzipped and loads with async, so it never blocks your page from rendering. It sets no cookies.
Where to put it
Put the snippet inside <head>, once, in the template or layout that every page shares. If your site has a shared header, root layout or theme file, that's the place.
- Every page. A page without the snippet isn't tracked. Use the shared layout, not individual pages.
- Once. Loading the script twice on the same page sends every pageview twice.
- In
<head>. The earlier the script loads, the fewer quick visits you miss. Plain<script async>in<head>is the recommended setup on every platform, including Next.js.
Prefer to let your coding assistant do it? See Install with an AI assistant.
Pick your platform
Install with an AI assistant
Paste one prompt into Cursor, Claude Code, Lovable, Bolt or v0.
Plain HTML
Static sites and any tool with a head code field.
Next.js
App Router and Pages Router.
React
Vite and Create React App.
Vue
Vite, Vue CLI and Nuxt.
Astro
Your root layout, view transitions included.
Shopify
Theme script plus the Muro pixel for carts and purchases.
Webflow
Site settings, head code.
Framer
Site settings, custom code.
WordPress
A header plugin or your theme.
Verify it works
Load a page of your live site, then check one of these:
- Onboarding. If you're still on step 2, "Waiting for first event…" changes to "Data received!" a few seconds after your page loads.
- Live mode. On the Dashboard, open the time picker and choose Live. Your visit appears within about 30 seconds.
- Browser DevTools. Open the Network tab, filter by
collectand reload. You should see aPOSTtocdn.muroanalytics.com/collectwith status202.
Nothing showing up? See No events are arriving.
Content Security Policy
If your site sends a Content-Security-Policy header or meta tag, the browser blocks Muro until you allow both of its domains:
script-src https://api.muroanalytics.comlets the script load.connect-src https://cdn.muroanalytics.comlets it send events.
Missing either one fails silently. See Fix Content Security Policy errors for examples.
Single-page apps
You don't need any router code. Muro records a new pageview whenever your app navigates with history.pushState or the visitor uses back and forward, which covers Next.js, React Router, Vue Router, Astro view transitions and most others. Hash-based routes (/#/settings) aren't tracked as separate pages. See Single-page apps.