brily-flow
v0.1.1
Published
Tiny browser SDK for Brily Flows. Autocaptures $pageview, tracks custom events, and identifies anon users across subdomains.
Maintainers
Readme
brily-flow
Tiny browser SDK (≈3 KB gzipped) that powers Brily Flows — conversion funnels built from $pageview events + anything custom you want to track.
Install
npm i brily-flowor drop this script tag anywhere in your HTML:
<script src="https://cdn.jsdelivr.net/npm/brily-flow/dist/index.global.js"></script>
<script>
BrilyFlow.init({ token: "brly_live_..." });
</script>Usage
import { init, identify, track } from "brily-flow";
init({
token: "brly_live_...", // API token with scope: events:write
cookieDomain: ".example.com", // optional — enables cross-subdomain identity
});
// When the user logs in, merge their anon history into their user id:
identify("user_42");
// Any custom business event:
track("checkout.started", { plan: "pro", cart_value: 29.0 });$pageview events are captured automatically (including SPA navigations via History API). Disable with init({ autocapture: false, ... }).
What gets sent
Every event posts to POST /api/v1/events with Authorization: Bearer <token>:
{
"events": [{
"event": "$pageview",
"distinct_id": "anon_abc123...",
"session_id": "sess_...",
"properties": { "$current_url": "...", "$host": "...", "$path": "/pricing" },
"occurred_at": "2026-04-21T12:34:56.789Z"
}]
}Events are batched (≤100 per request) and flushed on page hide / unload too.
License
MIT
