Catalog npm
PACKAGE EXPLORERView in registry

11metrics-pixel-next

npm

Next.js App Router adapter for 11metrics-pixel-js. Drop <PixelProvider /> in your root layout and it initialises the pixel plus fires pageview() automatically on every client-side route change.

11metricsanalyticsnext.jsnextjspixeltracking
Versions collected1
Direct dependencies6From release 0.1.0
Last observed20 Oct, 18:05 UTC

README

Current package documentation

11metrics-pixel-next

Next.js App Router adapter for 11metrics-pixel-js. Solves the one thing the raw <script src="pixel.js"> tag can't: firing pageview() again on every client-side route change (App Router navigation doesn't trigger a full page load, so the script's automatic first-load pageview never repeats on its own).

Install

npm install 11metrics-pixel-next

(Pulls in 11metrics-pixel-js automatically. Not yet published — see "Publishing" below.)

Usage

Add your workspace's pixel ID to .env.local:

NEXT_PUBLIC_11METRICS_PIXEL_ID=your_pixel_id
NEXT_PUBLIC_11METRICS_PIXEL_URL=https://app.11metrics.ai

Then mount the provider once in your root layout:

// app/layout.tsx
import { PixelProvider } from '11metrics-pixel-next';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <PixelProvider />
        {children}
      </body>
    </html>
  );
}

No props needed if the env vars are set — pixelId / pixelUrl props override them per-environment when you need to.

Everything else (track, identify, setNetworkConsent) is re-exported from 11metrics-pixel-js for convenience:

import { identify } from '11metrics-pixel-next';

identify({ email: user.email, first_name: user.firstName });

Why this exists

public/pixel.js, dropped in as a raw <script> tag, fires exactly one pageview on initial script execution — there's no pushState/popstate hook. In an App Router app that means only the very first page a visitor lands on ever gets tracked; every subsequent client-side navigation is invisible. PixelProvider watches usePathname()/useSearchParams() and calls the pixel's pageview() method (added for this purpose) on every change.

Local development

Not published yet. To build/typecheck locally against ../pixel-js without polluting package.json's published dependency range:

npm install file:../pixel-js --no-save --legacy-peer-deps
npm run build

Publishing

Publish 11metrics-pixel-js first (this package depends on it). Then:

npm run build
npm login          # once, with your npm account
npm publish         # from this directory

Bump version in package.json first if this isn't the first release.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.0Registry latest3 Jul 20266

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 18:05 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:5e343b685dec5e809c682be6d4d760958894c6e6d43354d7989a5259b4e337df