Installing and tracking
Server-side events
Send authoritative custom and purchase events with a per-site write key.
Create a write key under Settings → API keys. Send POST /api/track with Authorization: Bearer YOUR_WRITE_KEY. A request can include one event or a batch, an optional PageDuel visitor ID, revenue, properties, and request context.
Keep write keys on the server. Never place one in browser JavaScript, a public repository, or a client app. Regenerate a key if exposed and revoke unused keys.
Connect the browser visitor with PageDuel.getVisitorId() so server-side signup, purchase, or subscription events retain acquisition and experiment attribution. Use an idempotent order identifier and one ingestion path for financial events.