Muro
Installation guides

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

Verify it works

Load a page of your live site, then check one of these:

  1. Onboarding. If you're still on step 2, "Waiting for first event…" changes to "Data received!" a few seconds after your page loads.
  2. Live mode. On the Dashboard, open the time picker and choose Live. Your visit appears within about 30 seconds.
  3. Browser DevTools. Open the Network tab, filter by collect and reload. You should see a POST to cdn.muroanalytics.com/collect with status 202.

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.com lets the script load.
  • connect-src https://cdn.muroanalytics.com lets 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.

Next steps

On this page