Website analytics
Framework guides
Where the tracker goes in Next.js, Nuxt, SvelteKit, Astro, React, Vue and static site generators.
The tracker works the same everywhere: put the tag in the <head> of every page, once. Route changes in single-page
apps are detected automatically, so you never call anything on navigation.
In every example, replace the src, integrity and data-site values with the ones from your website's Snippet
tab.
App Router: add the tag to the root layout.
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<script
src="https://e1.usagemap.dev/lib/1.1.0/standard.js"
integrity="sha384-AYjFWyBUxxvOL92oDDKxAus7EAPjONT2RDrOiuPh4XUiEJNKkMaZqGVBDw4Lqn0+"
crossOrigin="anonymous"
data-site={process.env.NEXT_PUBLIC_USAGEMAP_SITE}
defer
/>
</head>
<body>{children}</body>
</html>
);
}Check it works
Deploy, then open your site in a normal browser window (without Global Privacy Control).
In the browser's network tab, you should see the tracker file load and a
POST to /v1/c.Open Installation check in the app: your event appears within about a minute, with its verdict.
Nothing showing up? See troubleshooting.