SDK reference
Methods available on the Brekky global (web) and native SDKs.
Methods by platform
The script exposes window.Brekky. Queue calls before load if the script is deferred.
| Method | Description |
|---|---|
Brekky.track(name, properties?) | Send a custom event. Name is normalized to lowercase a-z0-9_. Properties are sanitized (string length, types). |
Brekky.page() | Manual page view (usually automatic). |
Brekky.identify(userId, traits?) | Attach a user ID and optional traits to future events. Traits sync server-side. |
Brekky.alias(userId, previousId?) | Merge anonymous traffic into a known user. previousId defaults to visitor ID. |
Brekky.reset() | Clear identity and rotate visitor/session IDs. Call on logout. |
Brekky.handoffUrl(url, properties?) | Stamp ?bk_h= on a URL and send handoff_started. Destinations consume bk_h automatically. |
JavaScript
Brekky.track('purchase', { amount: 49, currency: 'USD' });
Brekky.identify('user_42', { plan: 'pro' });
Brekky.alias('user_42');
Brekky.reset();
Brekky.page();Script attributes
data-app (required) is your write key. data-api (optional) overrides the ingest URL.
Event payload (web)
Each event sent to ingest includes:
JSON
{
"name": "cta_click",
"timestamp": "2026-09-01T12:00:00.000Z",
"visitor_id": "uuid",
"session_id": "uuid",
"user_id": "optional",
"properties": { "button": "hero_signup" },
"context": {
"url": "https://yoursite.com/pricing",
"path": "/pricing",
"title": "Pricing",
"referrer": "",
"locale": "en-AU",
"timezone": "Australia/Sydney",
"viewport": { "w": 1440, "h": 900 },
"utm": { "source": "twitter" },
"device_type": "desktop",
"browser": "Chrome",
"os_name": "macOS",
"sdk": { "name": "brekky.js", "version": "0.1.0" }
}
}Batch ingest
Events batch to the ingest endpoint via POST with Content-Type: text/plain. The body wraps up to 10 events:
JSON
{
"write_key": "bm_...",
"sent_at": "2026-09-01T12:00:01.000Z",
"events": [ /* ... */ ]
}You normally never call ingest directly. Use the SDK or snippet from Install the tracker.
Session length (web)
Sessions expire after 30 minutes of inactivity, then a new session ID is issued.
Server-side events
For purchases and other trusted events, POST directly to ingest from your backend with the app write key. Include user_id when you know it. The Events purchase guide includes a Stripe webhook example. See Track custom events for when to use server-side tracking.