{"_id":"@alextorresrex/tracka-client","_rev":"3-25ec2b3f30506de1ecb5bbf6174214c2","name":"@alextorresrex/tracka-client","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@alextorresrex/tracka-client","version":"0.1.0","author":{"name":"Alex Torres"},"license":"MIT","_id":"@alextorresrex/tracka-client@0.1.0","maintainers":[{"name":"alextorresrex","email":"hey@alextorres.me"}],"dist":{"shasum":"45e35e20c581c9727817084958b90bef7370fc05","tarball":"https://registry.npmjs.org/@alextorresrex/tracka-client/-/tracka-client-0.1.0.tgz","fileCount":7,"integrity":"sha512-XwkX3+8pEWulWvihPlMyO/VI1A2JumZPMPZe7DGemUf+WubvAobhV52LFO64p8A/DYvh7RSk7WkqOUnWe3Z54w==","signatures":[{"sig":"MEQCIDpGtigDehYUmrU8qBmhVfThI+1ijVQUG3xxTmReVka/AiBoEq0Xb98cY53mBs9vtX+HtDk4m9NN66L9XPnBlZdLtw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10126},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"3f9884ef3a0eaf15378be202b77c20c0d61d1982","scripts":{"build":"tsc -p tsconfig.json","prepublishOnly":"tsc -p tsconfig.json"},"_npmUser":{"name":"alextorresrex","email":"hey@alextorres.me"},"_npmVersion":"10.9.2","description":"TypeScript client for the Tracka ingest API.","directories":{},"_nodeVersion":"22.14.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0"},"_npmOperationalInternal":{"tmp":"tmp/tracka-client_0.1.0_1778665624852_0.47249369451154655","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@alextorresrex/tracka-client","version":"0.2.0","author":{"name":"Alex Torres"},"license":"MIT","_id":"@alextorresrex/tracka-client@0.2.0","maintainers":[{"name":"alextorresrex","email":"hey@alextorres.me"}],"dist":{"shasum":"6057616c1b9ba9fd735a6f5751ef792c8ce2be81","tarball":"https://registry.npmjs.org/@alextorresrex/tracka-client/-/tracka-client-0.2.0.tgz","fileCount":7,"integrity":"sha512-gvtq0SfT1fnzqN5akXvpSdD2Nw3wO2Xdz09cu3aHl34RzSk02BdXYKoawQrAoBzQz1dKCN08yAt9wF16ytiwxA==","signatures":[{"sig":"MEYCIQC6RywAAy0GBhSP7LMxtwUwxYoHfgmiJkWnpMVmeZPNOQIhAPExdISIfLVrlX+yTyxnVU3ExYpSu6LkBuE1i2AL0qHr","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10141},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"736ecfbee94cd11a5a5a555ca65789056f7acd26","scripts":{"build":"tsc -p tsconfig.json","prepublishOnly":"tsc -p tsconfig.json"},"_npmUser":{"name":"alextorresrex","email":"hey@alextorres.me"},"_npmVersion":"10.9.2","description":"TypeScript client for the Tracka ingest API.","directories":{},"_nodeVersion":"22.14.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0"},"_npmOperationalInternal":{"tmp":"tmp/tracka-client_0.2.0_1778665863435_0.4050218189069279","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@alextorresrex/tracka-client","version":"0.3.0","description":"TypeScript client for the Tracka ingest API.","license":"MIT","author":{"name":"Alex Torres"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","prepublishOnly":"tsc -p tsconfig.json"},"publishConfig":{"access":"public"},"devDependencies":{"typescript":"^5.6.0"},"_id":"@alextorresrex/tracka-client@0.3.0","gitHead":"fa213bfa111b1e7fa2517b76f2c16851f02f93f4","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-aBwesENvXABAWWxFYRh9vIvWGeyl2dj8ayYqXRu015zQ/W8X2sU7c0EeOAF0/iHzlHd6HYspqM6RXGftOKJ3wg==","shasum":"17e2f2b1cc0620874ef1c643784949b5274d039d","tarball":"https://registry.npmjs.org/@alextorresrex/tracka-client/-/tracka-client-0.3.0.tgz","fileCount":7,"unpackedSize":10148,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDkXGNRhr8EIfNWniFbhJsdQcP+GDOjm+v6vOF3KLiC4AIhALXZZPDorhtaRph36zQKHM+4EsbaKMwdac2nLvKLQGBM"}]},"_npmUser":{"name":"alextorresrex","email":"hey@alextorres.me"},"directories":{},"maintainers":[{"name":"alextorresrex","email":"hey@alextorres.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tracka-client_0.3.0_1778667719463_0.008460298749903394"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-13T09:47:04.751Z","modified":"2026-05-13T10:21:59.700Z","0.1.0":"2026-05-13T09:47:04.988Z","0.2.0":"2026-05-13T09:51:03.550Z","0.3.0":"2026-05-13T10:21:59.609Z"},"author":{"name":"Alex Torres"},"license":"MIT","description":"TypeScript client for the Tracka ingest API.","maintainers":[{"name":"alextorresrex","email":"hey@alextorres.me"}],"readme":"# @alextorresrex/tracka-client\n\nTypeScript client for the Tracka ingest API. Use this from backends (Bun,\nNode 18+, Deno, edge) when you want to record events or pageviews that the\nbrowser script can't see — webhooks, background jobs, SSR pageviews, etc.\n\n## Install\n\n```sh\nbun add @alextorresrex/tracka-client\n# or\nnpm install @alextorresrex/tracka-client\n```\n\n## Usage\n\n```ts\nimport { Tracka } from \"@alextorresrex/tracka-client\";\n\nconst tracka = new Tracka({ site: \"my-app\" });\n\nawait tracka.event(\"signup\", { plan: \"pro\" });\nawait tracka.pageview(\"/welcome\");\n```\n\n## API\n\n### `new Tracka(options)`\n\n| Option     | Required | Default                              | Purpose                                                                   |\n| ---------- | -------- | ------------------------------------ | ------------------------------------------------------------------------- |\n| `site`     | yes      | —                                    | Site identifier sent with every event. Matches `data-site` on the script. |\n| `endpoint` | no       | `https://haha.alextorres.me/api/sync`     | Override the ingest endpoint (useful for self-hosted instances).          |\n| `fetch`    | no       | `globalThis.fetch`                   | Custom fetch implementation. Required on runtimes without global fetch.   |\n\n### `tracka.event(name, props?)`\n\nRecords a named custom event. `props` is any JSON-serializable value and is\nforwarded verbatim. Resolves on 2xx; rejects on network errors or non-2xx\nresponses.\n\n```ts\nawait tracka.event(\"video_play\");\nawait tracka.event(\"checkout_completed\", { amount: 4900, currency: \"usd\" });\n```\n\n### `tracka.pageview(path, referrer?)`\n\nRecords a pageview. Unlike the browser script, the backend has no `location`\nto read — pass the path explicitly. `referrer` is optional.\n\n```ts\nawait tracka.pageview(\"/welcome\");\nawait tracka.pageview(\"/welcome\", \"https://google.com/\");\n```\n\n## Notes\n\n- Calls are awaited and throw on failure — wrap in `try`/`catch` (or fire\n  and forget with `.catch()`) if you don't want analytics errors to bubble\n  into your request path.\n- The server fills in `ts`, `user_agent`, `ip_hash`, `visitor_id`, and\n  `country` from the HTTP request. From a backend, those reflect *your\n  server*, not the end user.\n","readmeFilename":"README.md"}