{"_id":"11metrics-pixel-next","name":"11metrics-pixel-next","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"11metrics-pixel-next","version":"0.1.0","description":"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.","license":"MIT","author":{"name":"11metrics Ltd."},"homepage":"https://app.11metrics.ai/extensions","keywords":["11metrics","analytics","tracking","pixel","nextjs","next.js"],"private":false,"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"sideEffects":false,"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"dependencies":{"11metrics-pixel-js":"^0.1.0"},"peerDependencies":{"next":">=13.4.0","react":">=18.0.0"},"devDependencies":{"typescript":"^5.6.0","@types/react":"^19.0.0","@types/node":"^22.0.0"},"gitHead":"07e2aa3f94bc6f673be14bfa0b5e7047d42a0496","_id":"11metrics-pixel-next@0.1.0","_nodeVersion":"25.2.1","_npmVersion":"11.6.2","dist":{"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="}]},"_npmUser":{"name":"11metrics","email":"marco.stranieri@11metrics.ai"},"directories":{},"maintainers":[{"name":"11metrics","email":"marco.stranieri@11metrics.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/11metrics-pixel-next_0.1.0_1783058126891_0.23591409597114965"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-03T05:55:26.824Z","0.1.0":"2026-07-03T05:55:27.030Z","modified":"2026-07-03T05:55:27.264Z"},"maintainers":[{"name":"11metrics","email":"marco.stranieri@11metrics.ai"}],"description":"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.","homepage":"https://app.11metrics.ai/extensions","keywords":["11metrics","analytics","tracking","pixel","nextjs","next.js"],"author":{"name":"11metrics Ltd."},"license":"MIT","readme":"# 11metrics-pixel-next\n\nNext.js App Router adapter for [`11metrics-pixel-js`](../pixel-js). Solves the\none thing the raw `<script src=\"pixel.js\">` tag can't: firing `pageview()`\nagain on every client-side route change (App Router navigation doesn't\ntrigger a full page load, so the script's automatic first-load pageview never\nrepeats on its own).\n\n## Install\n\n```\nnpm install 11metrics-pixel-next\n```\n\n(Pulls in `11metrics-pixel-js` automatically. Not yet published — see\n\"Publishing\" below.)\n\n## Usage\n\nAdd your workspace's pixel ID to `.env.local`:\n\n```\nNEXT_PUBLIC_11METRICS_PIXEL_ID=your_pixel_id\nNEXT_PUBLIC_11METRICS_PIXEL_URL=https://app.11metrics.ai\n```\n\nThen mount the provider once in your root layout:\n\n```tsx\n// app/layout.tsx\nimport { PixelProvider } from '11metrics-pixel-next';\n\nexport default function RootLayout({ children }) {\n  return (\n    <html lang=\"en\">\n      <body>\n        <PixelProvider />\n        {children}\n      </body>\n    </html>\n  );\n}\n```\n\nNo props needed if the env vars are set — `pixelId` / `pixelUrl` props\noverride them per-environment when you need to.\n\nEverything else (`track`, `identify`, `setNetworkConsent`) is re-exported\nfrom `11metrics-pixel-js` for convenience:\n\n```tsx\nimport { identify } from '11metrics-pixel-next';\n\nidentify({ email: user.email, first_name: user.firstName });\n```\n\n## Why this exists\n\n`public/pixel.js`, dropped in as a raw `<script>` tag, fires exactly one\npageview on initial script execution — there's no `pushState`/`popstate`\nhook. In an App Router app that means only the very first page a visitor\nlands on ever gets tracked; every subsequent client-side navigation is\ninvisible. `PixelProvider` watches `usePathname()`/`useSearchParams()` and\ncalls the pixel's `pageview()` method (added for this purpose) on every\nchange.\n\n## Local development\n\nNot published yet. To build/typecheck locally against `../pixel-js` without\npolluting `package.json`'s published dependency range:\n\n```\nnpm install file:../pixel-js --no-save --legacy-peer-deps\nnpm run build\n```\n\n## Publishing\n\nPublish `11metrics-pixel-js` first (this package depends on it). Then:\n\n```\nnpm run build\nnpm login          # once, with your npm account\nnpm publish         # from this directory\n```\n\nBump `version` in `package.json` first if this isn't the first release.\n","readmeFilename":"README.md","_rev":"1-d98eddabb4c3e56aefe12c904362c2e1"}