Muro is live on RocketHub.Get the deal →

React framework

Analytics for Next.js

Add Muro analytics to any Next.js app with one Script tag. Works with App Router and Pages Router.

30-day free trial. No credit card. Cancel anytime.

Why analytics matter for Next.js sites

Next.js apps need analytics that respect Core Web Vitals and don't break SSR. Many analytics tools add a heavy script and extra setup in your layout. Muro is one tiny async script under 2 KB, works with both App Router and Pages Router, and counts client-side route changes without any extra config.

How to add Muro to Next.js

Adding Muro to a Next.js app takes about two minutes. The setup is slightly different for App Router vs Pages Router, but both are simple:

01

Import the Script component

In your root layout (app/layout.tsx for App Router, pages/_app.tsx for Pages Router), add import Script from 'next/script'.

02

Add the Muro script

Add <Script src="https://api.muroanalytics.com/muro.js" data-project-id="YOUR_KEY" strategy="afterInteractive" /> to your layout so it loads on every route.

03

Deploy

Deploy your Next.js app. Muro starts counting pageviews across all your routes, including client-side navigation. Visits show up in your dashboard within seconds.

Works with both App Router (Next.js 13+) and Pages Router. Plays nicely with Vercel Analytics, Speed Insights, and other observability tools.

What Muro tracks on Next.js

Once installed, Muro tracks the things that matter | automatically.

Pageviews across all routes (App Router and Pages Router), automatically

Client-side route changes, with no extra config

Where visitors come from (referrers and UTM campaigns), plus devices and countries

Custom events you fire with muro.track() or tag with a data-muro-event attribute

Signups and other goals, when you mark a thank-you page as a goal or fire a custom event

Real situations where Muro helps Next.js users

These are the kinds of moments where a short morning email beats remembering to open a dashboard.

01

Your /blog index suddenly becomes your top entry point

Muro shows your top pages in the morning brief and entry pages in the dashboard. When /blog jumps, you'll see it, often because a specific post started ranking, without having to dig through Search Console.

02

You shipped a new landing page and want to know if it converts

Keep both on separate routes, like /old-landing and /new-landing, and mark your signup confirmation page as a goal. Muro shows conversion rate per page, so you can compare the two side by side.

03

You want to count clicks that don't change the page

Call muro.track('event-name') from a component, or add data-muro-event="event-name" to a button. Useful for modal opens, copy buttons, or feature usage.

What you'll actually get

Alongside a full dashboard, Muro sends a short plain-English summary every morning. Here's the kind of note a Next.js site might see.

Alert

Traffic dropped 38% yesterday

You had 620 visitors yesterday, down from about 1,000 on a typical day.

Tips for getting more out of Muro on Next.js

Quick wins from people who use Muro every day.

Use strategy="afterInteractive" for the Muro script. It loads right after the page becomes interactive and still catches the first pageview.

App Router and Pages Router both work fine with Muro. If you're using App Router, put the Script tag in app/layout.tsx so it applies to every route.

To fire a custom event from a client component, call window.muro?.track('event_name', { plan: 'pro' }). The optional chaining keeps it safe if the script hasn't loaded yet.

For buttons and links, you can skip JavaScript and add data-muro-event="signup-click" to the element instead.

Muro plays nice with Vercel Analytics and Speed Insights. They serve different purposes: Vercel for performance and pageviews, Muro for sources, goals, and a plain-English daily summary.

If you're using next-intl or i18n, Muro tracks each locale's pageviews separately because the URLs differ.

Common questions about Muro on Next.js

Yes. Add the Script component to either app/layout.tsx (App Router) or pages/_app.tsx (Pages Router) and it works.

The script is tiny (under 2 KB) and loads asynchronously, so it stays out of the way of rendering. Loading it with strategy="afterInteractive" keeps it off the critical path.

Yes. Muro runs alongside Vercel's tools. Vercel Analytics shows pageviews and Web Vitals. Muro adds goal-based conversion tracking, source and campaign detail, and a plain-English email every morning.

Yes. Call window.muro?.track('event_name') from any client component, or add a data-muro-event attribute to a button or link. Useful for clicks, modal opens, or feature usage that doesn't trigger navigation.

Try Muro on your Next.js site

Setup takes 2 minutes. Your first morning brief arrives tomorrow at 8 AM.

30-day free trial. No credit card. Cancel anytime.