Be up and running in under 5 minutes
init once, and uncaught errors, unhandled rejections and every fetch/XHR call are captured automatically.Install the package
Add
@codeskop/trackerfrom npm. It has no runtime dependencies.Terminalnpm install @codeskop/trackerTerminalyarn add @codeskop/trackerTerminalpnpm add @codeskop/trackerLatest version: 1.3.0
The package is free and MIT-licensed on the public npm registry, no token or.npmrcsetup needed. Using React? Also see the React guide.Initialize Codeskop
Call init as early as possible (ideally at the top of your entry file) so capture starts before your app code runs.
main.tsimport { init } from "@codeskop/tracker"; init({ apiKey: "cs_live_pk_YOUR_KEY", release: "1.4.0", // optional: your app's version});Get your ingest key
Create a project in the Codeskop dashboard and copy its public key. It starts withcs_live_pk_(orcs_test_pk_for testing). Public keys can only write events, so they're safe in browser code. Never use a secret key (cs_…_sk_); the SDK refuses it and stays off.That's the whole integration for error and network capture.
initreturns immediately and does its work in the background.Identify your users
Optional, but recommended: see which users an issue affects.
auth.tsimport { identify, reset } from "@codeskop/tracker"; // After a successful login, use your own stable user id, never an emailidentify(user.id); // On logoutreset();Pass an ID from your own system. Until you call
identify, events are tied to an anonymous ID stored in the browser.Verify installation
Send a test event and confirm it reaches your dashboard.
Browser console or a debug buttonimport { recordException, flush } from "@codeskop/tracker"; recordException(new Error("Codeskop test event"));await flush(); // sends the queue right away instead of waiting for the next syncOpen your project in the dashboard to see the event. Without
flush(), the SDK sends events in batches: when 20 are queued, every 30 seconds, when the browser comes back online, or when the tab is hidden.Nothing showing up?
Check the key is a publicpkkey and your plan is active, then look for the/v1/eventsrequest in your browser's Network tab. The troubleshooting guide covers every common cause.