Open-source product analytics that lives in your Cloudflare account.
Web analytics, funnels and retention, session replay, feature flags and A/B tests. Deployed with one command, queried by your coding agent. Your data never leaves your account.
Live demo · Docs · Cost calculator · Comparisons
npx dataflare-cli initOr paste this into your coding agent:
Add Dataflare analytics to this project: run
npx dataflare-cli init, track signups and purchases, then show me today's visitors.
- No vendor. Dataflare is a Worker, a D1 database and an R2 bucket in your Cloudflare account. There is no Dataflare server, account or bill: you pay Cloudflare's list prices, which is $0 on Workers Free for small sites and the $5/month Workers Paid plan for most others (calculator).
- Built for agents.
dataflare initwrites instructions, a skill and an MCP server config for your agent. Every query result carries its SQL and a dashboard link, and session replays come with a text transcript an agent can read. - Four tools, one event stream. Web stats, funnels/retention/trends on any property, session replay, and flags with Bayesian A/B testing. A funnel step links to the replays of the people who dropped out.
- Small and readable. The browser SDK is about 4 KB gzipped. The Worker has one runtime dependency (zod). Every number in the dashboard can show the SQL behind it.
![]() Funnels, trends and retention on any event |
![]() Session replay with a transcript agents can read |
![]() Flags and A/B tests with Bayesian results |
![]() Read-only SQL behind every number |
| Dataflare | PostHog | Google Analytics | Plausible | |
|---|---|---|---|---|
| Where your data lives | Your Cloudflare account | PostHog Cloud, or your servers | Plausible Cloud (EU), or your servers | |
| Source | MIT | MIT (some paid features separate) | Proprietary | AGPL-3.0 |
| Session replay | Yes, with agent transcripts | Yes | No | No |
| Flags and A/B tests | Yes | Yes | No | No |
| Raw SQL | Yes | Yes | BigQuery export | No |
Each comparison on the site says where the other product is the better choice: PostHog, Google Analytics, Plausible, Amplitude, Mixpanel, Umami, Cloudflare Web Analytics.
-
Create a Cloudflare API token at dash.cloudflare.com/profile/api-tokens with Workers Scripts: Edit, D1: Edit, Workers R2 Storage: Edit and Account Settings: Read.
-
Deploy from your project directory:
CLOUDFLARE_API_TOKEN=… npx dataflare-cli init
This creates the database, the replay bucket and the Worker, then prints the snippet for your framework.
-
Add the snippet to every page:
<script defer src="https://glass.<you>.workers.dev/s.js" data-project="my-app"></script>
-
Track what matters:
glass.capture('signup_completed', { plan: 'pro' }); glass.identify(user.id, { plan: user.plan }); // after login
-
Ask. Open
https://glass.<you>.workers.dev/app(sign in withnpx dataflare-cli key), or ask your agent: "Which traffic source converts best to signup?"
Run npx dataflare-cli status any time to check everything end to end. See docs/getting-started.md for frameworks, custom domains and EU data residency.
| Web analytics | Visitors, pageviews, sessions, bounce rate, top/entry/exit pages, referrers, UTMs, countries, devices, errors, Core Web Vitals. Cookieless mode available. |
| Product analytics | Trends, funnels and retention on any event, with filters and breakdowns on any event or person property. Read-only SQL for everything else. |
| People | identify() links anonymous visits to users, so funnels span the moment of signup. Person properties are snapshotted on every event. |
| Session replay | rrweb recording with inputs masked, sampling and "record when an error happens", plus console messages and network requests. A player with a timeline of clicks, errors and notes; search by what went wrong; patterns across sessions. Each session has a transcript agents read: pages, clicks with selectors, rage and dead clicks, errors with stacks, failed requests. |
| Flags and experiments | Flags evaluated server-side in your Worker, with targeting rules. Experiments report exposures, conversion, Bayesian probability to beat control, lift intervals and sample-ratio mismatch. |
| Agent interface | An MCP server with 41 tools, a CLI with --json everywhere, an HTTP API, and llms.txt. |
browser ──/s.js, /e, /r, /f──▶ Dataflare Worker ──▶ D1 (events, people, flags, experiments, replay index)
agents ──/mcp, /api───────▶ (your account) ──▶ R2 (replay chunks)
you ──/app─────────────▶ ──▶ optional: Pipelines → Iceberg on R2 → Basin SQL
Every query (web, trends, funnels, retention, experiments) compiles to SQL that runs on both D1 (SQLite) and Basin SQL, so you can start on the free plan and move high-volume event storage to the lake with dataflare init --lake. More in docs/architecture.md.
- Getting started: install, frameworks, custom domain, EU, upgrading
- Browser SDK:
init,capture,identify, flags, replay, consent - Agents: MCP tools, CLI, HTTP API
- Queries: properties, filters, time ranges, every query type, SQL
- Experiments: flags, assignment and the statistics
- Privacy: what's stored, cookieless mode, deletion
- Architecture and the lake store
- Extending Dataflare: add a query type, MCP tool, storage engine or framework
Dataflare is new. The D1 store, SDK, dashboard, MCP server and CLI are covered by unit, integration and browser end-to-end tests. The lake store is checked against DataFusion in CI and has been load-tested on production Basin SQL at 30 million events; it relies on Cloudflare Pipelines, which is still in beta. See ROADMAP.md.
Contributions are welcome. CONTRIBUTING.md explains the layout, how to run everything locally without a Cloudflare account (pnpm dev), and where to add things. Coding agents should read AGENTS.md.



