Catalog npm
Back to packageRELEASE DETAILS

0.1.0

npm

11metrics-pixel-next

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
Published3 Jul 2026
Direct dependencies6
Transitive dependenciesNot calculated

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.

Declared dependencies 6

Native requirements
6 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
11metrics-pixel-js
Environment
{
  "local_name": "11metrics-pixel-js",
  "alias": false,
  "peer_metadata": null
}
^0.1.0runtime
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.6.0development
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^19.0.0development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^22.0.0development
next
Environment
{
  "local_name": "next",
  "alias": false,
  "peer_metadata": null
}
>=13.4.0peer
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
>=18.0.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-Zm7oLLMCJOTgJ13YX3h4iGW6YW1dCkzdlqy+yEZKS/ZQshavJscw70CyNqtOdbHMQ6B3oSWMJLFYOw7+vsMUDw==",
  "shasum": "fd88f1d68d35e432c9d5bfbaf4acbc8961ad3da8",
  "tarball": "https://registry.npmjs.org/11metrics-pixel-next/-/11metrics-pixel-next-0.1.0.tgz",
  "fileCount": 11,
  "unpackedSize": 10006,
  "signatures": [
    {
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
      "sig": "MEUCIQCx2+PuPN1KR+WKAckra/Acv2mm0UaSQ+j82eCMgg7NVQIgVx0yGWmI878GTCOvFVsQ5bMNVPuG8CtEVmhmdlv9UyY="
    }
  ]
}

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_version:e9ccabdd307a60795706e3adc7e98e18ad585a6ad9ee8beb1e24cf72fcb82f86

Other collected versions

View all collected versions →