{"_id":"@addilytics/wintercg","name":"@addilytics/wintercg","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@addilytics/wintercg","version":"0.0.1","description":"Addilytics server capture and bundled browser relay for WinterCG handlers.","type":"module","license":"MIT","publishConfig":{"access":"public"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./browser":{"types":"./dist/browser.d.ts","default":"./dist/browser.js"}},"dependencies":{"addilytics":"0.0.1"},"devDependencies":{"typescript":"^6.0.3"},"scripts":{"build":"tsc -p tsconfig.json","check":"tsc -p tsconfig.json --noEmit","test":"pnpm build && node --test test/*.test.mjs"},"_nodeVersion":"26.0.0","_id":"@addilytics/wintercg@0.0.1","dist":{"integrity":"sha512-/47xIBQpb3wOXRtmwyYc8zmVgKSWcpKcmaB2xH3ZUaFjGLd51xd6cVbBsdp4UMLexNujfky9Nkq5vCWtRoISDw==","shasum":"1726d92a9543b38daf9f7c139f0f1f5d3b5731d1","tarball":"https://registry.npmjs.org/@addilytics/wintercg/-/wintercg-0.0.1.tgz","fileCount":6,"unpackedSize":6092,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDcUJSQ7WG9/kQvNsATA+YAltrfYBaN3RaG5yjJ1d8Q4AIhALF/HZWJxYDt9F3sKtVFDSFEWCKZ+s/YpeLQDHghVoyE"}]},"_npmUser":{"name":"embedvr","email":"npm@helium.email"},"directories":{},"maintainers":[{"name":"embedvr","email":"npm@helium.email"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wintercg_0.0.1_1789127080469_0.8961015628879885"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-11T11:44:40.309Z","0.0.1":"2026-09-11T11:44:40.608Z","modified":"2026-09-11T11:44:40.813Z"},"maintainers":[{"name":"embedvr","email":"npm@helium.email"}],"description":"Addilytics server capture and bundled browser relay for WinterCG handlers.","license":"MIT","readme":"# @addilytics/wintercg\n\nWraps Web `Request` handlers, including Cloudflare Workers, Deno, Bun, and edge runtimes. The wrapper\npreserves the handler's argument tuple, whether it receives one argument or several.\n\n```ts\nimport { withAddilytics } from '@addilytics/wintercg';\n\nexport default {\n\tfetch: withAddilytics(handler, {\n\t\tendpoint: 'https://addilytics.example',\n\t\tsiteKey: 'ak_...'\n\t})\n};\n```\n\nFor a runtime that stores its scheduler somewhere other than the handler arguments, pass a resolver:\n\n```ts\nconst wrapped = withAddilytics(handler, {\n\tendpoint: 'https://addilytics.example',\n\tsiteKey: 'ak_...',\n\twaitUntil: (platform) => platform.context.waitUntil.bind(platform.context)\n});\n```\n\nThe default `server` mode counts only requests that execute this handler. For an application with a\nclient router, use the tracker from `addilytics/browser` in the router's committed-navigation hook.\nThe tracker is compiled into your application and posts to the relay owned by the wrapper. There is\nno hosted script and the site key stays in server code.\n\n```ts\nconst analytics = withAddilytics(handler, {\n\tendpoint: 'https://addilytics.example',\n\tmode: 'client',\n\tsiteKey: env.ADDILYTICS_KEY\n});\n```\n\n```ts\nimport { createBrowserTracker } from '@addilytics/wintercg/browser';\n\nconst tracker = createBrowserTracker({ mode: 'client' });\nvoid tracker.pageview();\nexport const trackCommittedNavigation = (url: URL, key: string) =>\n\ttracker.pageview(url, { navigationKey: key });\nwindow.addEventListener('pageshow', (event) => {\n\tif (event.persisted) void tracker.pageview(location.href, { force: true });\n});\n```\n\nCall `trackCommittedNavigation` from the router's official post-navigation hook. Do not treat a\nloader, prefetch, or data request as a navigation.\n\n`client` mode disables automatic document pageviews and lets the browser count the initial load,\nso prerendered pages and CDN hits are covered. Use `hybrid` on both sides when every initial document\nreaches the server. Hybrid mode keeps the server pageview and skips the browser's first callback.\nHash-only changes are ignored unless `trackHashChanges` is true. If you change the browser\n`endpoint`, set the same path as `relayPath` on the wrapper.\n","readmeFilename":"","_rev":"1-320ab89d0016aa123fcc1467be806b6b"}