Analytics Integrations
Koryla can forward experiment assignment events to your analytics platform automatically. When a new visitor is assigned to a variant, the Worker fires a background event using waitUntil — so it never blocks the page load.
How it works
Every time a visitor is assigned to a variant for the first time, the edge function calls your configured analytics platform in the background. The event is fired only once per visitor per experiment — returning visitors who already have the ky_ cookie do not trigger a second event.
Astro demo: See
netlify/edge-functions/koryla.ts#L115-L132for thefireEventfunction that dispatches events without blocking the response.
Supported platforms
| Platform | Plans | Doc |
|---|---|---|
| Google Analytics 4 | Starter, Growth | Setup → |
| PostHog | Growth | Setup → |
| Plausible | Starter, Growth | Setup → |
| Mixpanel | Growth | Setup → |
| Amplitude | Growth | Setup → |
| Custom Webhook | Growth | Setup → |
Setting up an integration
- Go to Integrations in your workspace dashboard
- Select your analytics platform
- Enter your credentials (Measurement ID, API key, etc.)
- Toggle it on
Changes take effect within 60 seconds (the KV cache TTL).
Event schema
All integrations receive the same event data:
| Field | Type | Example |
|---|---|---|
experiment_id | UUID | "a1b2c3..." |
experiment_name | string | "Homepage CTA Test" |
variant_id | UUID | "x9y8z7..." |
variant_name | string | "Blue button" |
session_id | string | anonymous visitor identifier |
timestamp | ISO 8601 | "2026-04-10T22:00:00Z" |
Events fire only once per visitor
Analytics events are fired only on new variant assignments — not on every page view. A returning visitor who already has the ky_ cookie will not trigger another event. This keeps your data clean and prevents inflating event counts.