Quickstart

Install the SDK and send your first event.

1. Install

$npm install @pivolio/sdk

Or load the browser build from a CDN — it exposes a global pivolio:

1<script src="https://unpkg.com/@pivolio/sdk/dist/browser.browser.js"></script>

2. Initialize

1import { init, track } from "@pivolio/sdk";
2
3init({
4 writeKey: "YOUR_WRITE_KEY",
5 apiUrl: "https://api.pivolio.com",
6});

Grab your write key from the dashboard under Settings → Keys. Write keys can only ingest events, so they’re safe to ship in the browser.

3. Track an event

1track("order_completed", {
2 order_id: "ord_123",
3 revenue: 99.5,
4 currency: "USD",
5});

The event is validated at the edge, enriched server-side (identity resolution, geo, PII hashing), and delivered to your connected destinations.

4. Identify a customer

Tie anonymous activity to a known user:

1import { identify } from "@pivolio/sdk";
2
3identify({ user_id: "user_456", email: "jane@acme.com" });

Next, see Ingesting events for batching, page views, and server-side delivery.