analytics · side by side
DataFast vs PostHog for a Next.js app
Both fill the analytics slot, so a generated repo carries one or the other, never both. Every line below is read out of the two manifests.
Short answer
Pick DataFast if
Indie hackers and small SaaS teams who want one answer: which referrer, campaign or page produced revenue. Checkout attribution is wired for Stripe, Polar and Dodo. One script tag, no event plan needed on day one.
Pick PostHog if
Product teams who want funnels, retention, replay, flags, experiments and surveys on one event stream. One stream means one definition of "active user", not four. Good for early-stage teams, and SQL access answers the questions the dashboards cannot.
Side by side
Price, obligations, and the surface each one adds. No row is written by hand. This is manifest.yaml, rendered.
| From the manifest | Option ADataFast | Option BPostHog |
|---|---|---|
| In one line | DataFast Web analytics that tells you which channel made money, not just which one made visits. | PostHog Product analytics, session replay, feature flags and experiments behind one key. |
| Pricing | DataFast No free plan. A 14-day trial with no card. Starter is $9/month (1 site, 1 team member) and Growth $19/month (30 sites, 30 team members), both at 10k monthly events. Go over and tracking continues, but you must upgrade to open the dashboard. API, CLI and MCP access are on both plans. | PostHog Free every month, card or not: 1M analytics events, 5,000 session recordings and 1M feature flag requests. Past that, each product bills by usage, and you can set a billing limit per product. Self-hosting exists, but PostHog does not support it. |
| Best for | DataFast Indie hackers and small SaaS teams who want one answer: which referrer, campaign or page produced revenue. Checkout attribution is wired for Stripe, Polar and Dodo. One script tag, no event plan needed on day one. | PostHog Product teams who want funnels, retention, replay, flags, experiments and surveys on one event stream. One stream means one definition of "active user", not four. Good for early-stage teams, and SQL access answers the questions the dashboards cannot. |
| Trade-offsVerbatim from the manifest | DataFast
| PostHog
|
| Required companionsAdded for you, with a reason | DataFast Nothing. It stands on its own. | PostHog Nothing. It stands on its own. |
| Recommended alongsideSuggested, never added for you | DataFast
| PostHog
|
| Env vars you will manageEvery one documented in docs/onboard.md | DataFast 4 variables · 1 required
| PostHog 3 variables · 2 required
|
| Dependencies added | DataFast
| PostHog
|
| MCP serversWritten into .mcp.json | DataFast
| PostHog
|
| Footprint in your repo | DataFast 10 files, plus 4 injections into shared stack files | PostHog 6 files, plus 4 injections into shared stack files |
What changes in your repo
The paths each battery contributes, diffed. A path in the third list is written by both, so swapping rewrites that file rather than adding one.
Only with DataFast (9)
src/7 files
app/2 files
api/1 file
events/1 file
- route.ts
js/1 file
script.js/1 file
- route.ts
lib/5 files
analytics/5 files
- attribution.ts
- consent.ts
- datafast-client.ts
- datafast-server.ts
- goals.ts
variants/2 files
with-clerk/1 file
slots/1 file
- auth-public-routes.ts
with-payments/1 file
slots/1 file
- checkout-attribution.ts
Only with PostHog (5)
src/5 files
app/1 file
ingest/1 file
[...path]/1 file
- route.ts
lib/4 files
analytics/4 files
- events.ts
- identify.ts
- posthog-client.ts
- posthog-server.ts
Same path, different implementation (1)
src/1 file
lib/1 file
analytics/1 file
- provider.tsx
Shared stack files DataFast injects into
- env-required
- legal-processors
- providers
- verify-checks
Shared stack files PostHog injects into
- env-required
- legal-processors
- providers
- verify-checks
DataFast in your .env.local
# required
NEXT_PUBLIC_DATAFAST_WEBSITE_ID=dfid_exampledonotuse00000
# optional
DATAFAST_API_KEY=df_exampledonotuse0000000000000000
NEXT_PUBLIC_DATAFAST_ALLOW_LOCALHOST=false
NEXT_PUBLIC_DATAFAST_DOMAIN=example.com
PostHog in your .env.local
# required
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
NEXT_PUBLIC_POSTHOG_KEY=phc_exampleprojectapikeydonotuse000000000
# optional
POSTHOG_API_KEY=phx_examplepersonalapikeydonotuse00000000
What changes for your agents
Each battery ships rules, skills, subagents and hooks that an agent loads before it touches the code that battery owns. Picking one is also picking how your agents behave in src/lib/analytics/**.
DataFast
1
Skills
3
Rules
6
Solution docs
1
MCP servers
Rules (3)
Goals come from the catalogue, are named object_verb, and never carry personal data
src/lib/analytics/** · src/app/** · src/components/**
Every checkout carries the DataFast visitor id, and revenue is never a goal
src/lib/analytics/** · src/lib/billing/**
The DataFast script never blocks rendering, never skips consent, and never leaves your origin
src/lib/analytics/** · src/app/layout.tsx · src/app/js/** · src/app/api/events/**
Skills (1)
/add-goal
Add a DataFast goal to the typed catalogue and fire it from the right side of the network.
Subagents and hooks
None of its own. The foundation agents and guard hooks still ship.
PostHog
1
Agents
2
Skills
3
Rules
5
Solution docs
1
MCP servers
Rules (3)
Events are declared in the catalogue, named object_verb, past tense
src/lib/analytics/** · src/app/** · src/components/**
Identify before the first event that matters, reset on sign-out
src/lib/analytics/** · src/app/** · src/components/**
Server events for anything a client can lie about, and never PII in properties
src/lib/analytics/** · src/app/** · src/components/**
Skills (2)
/add-event
Add a product event end to end: catalogue entry, the question it answers, the capture call on the correct side of the network, and a check that it arrives.
/ask-product
Answer a question about user behaviour from this repo's event catalogue and the PostHog project, with the caveats that make the number usable.
Subagents and hooks
product-analyst
Read-only product analyst. Answers questions about user behaviour from the event catalogue and the PostHog project, and says plainly when the instrumentation cannot answer them.
What each one already knows
Solution docs land in docs/solutions/ in your repo and are published here, so you can read the failure modes before you commit.
DataFast (6)
- Cookie consent for DataFast in Next.js without breaking attributionDataFast sets a year-long first-party cookie, which needs opt-in consent in the EU and UK. Gate the script render, the goal queue and the checkout metadata on one flag.docs/solutions/datafast/cookie-consent-for-datafast.md
- DataFast shows nothing on localhost? That is on purpose. How to debug it anywayThe script skips localhost, 127.0.0.1, .local hosts, iframes and browsers flagged with datafast_ignore. Turn on data-allow-localhost for a session, check the network tab, then turn it off.docs/solutions/datafast/datafast-not-tracking-localhost.md
- DataFast goals versus page views, and when you need neitherPage views are free and automatic. Goals cost events and need a name, a reason and a side of the network. A decision table, the naming rule, and what never to put in a goal.docs/solutions/datafast/goals-vs-pageviews.md
- Proxy DataFast through your Next.js domain so ad blockers stop eating visitsBlockers match the datafa.st hostname. Serve the script and the events endpoint from your own origin with two route handlers, and forward the visitor's IP.docs/solutions/datafast/proxy-datafast-through-nextjs.md
- DataFast shows revenue as direct traffic? Pass the visitor id into checkout metadataDataFast attributes a payment by reading datafast_visitor_id from the checkout's metadata. Read the cookie on the server when you create the Stripe, Polar, Lemon Squeezy or Dodo checkout.docs/solutions/datafast/revenue-attribution-checkout-metadata.md
- Server-side DataFast goals from Next.js, and why the Goals API returns 404Send goals from route handlers and server actions with POST /api/v1/goals, after the response. The visitor id comes from the request cookie, and it must already have a page view.docs/solutions/datafast/server-side-goals-api.md
PostHog (5)
- Ad blockers eat a third of your analytics: proxy ingestion through your own domainBlockers match on hostnames, not behaviour. A first-party /ingest route handler forwards events to PostHog server-side and recovers most of the missing traffic.docs/solutions/posthog/ad-blocker-reverse-proxy.md
- Event names that still make sense in twelve monthsWhy analytics projects rot into five spellings of "signup", and the object_verb convention plus a typed catalogue that stops it.docs/solutions/posthog/event-naming-that-survives.md
- Feature flags without the flickerClient-side flags render the control experience first and swap it a beat later. Evaluate on the server, pass the decision down, and keep a bootstrap for the client hooks.docs/solutions/posthog/feature-flags-without-flicker.md
- The identify race that empties your signup funnelEvents fired before identify() stay on the anonymous profile forever. Here is why the merge is not retroactive, and the ordering that fixes it.docs/solutions/posthog/identify-race-conditions.md
- Server events versus client events, and when each one liesA browser event is a claim, a server event is a record. Which side to fire from, why serverless drops events without after(), and how to keep the two from double-counting.docs/solutions/posthog/server-vs-client-events.md
Which one to pick
From meta.bestFor and meta.tradeoffs. If a claim is not in the manifest, it is not on this page.
Pick DataFast when
Indie hackers and small SaaS teams who want one answer: which referrer, campaign or page produced revenue. Checkout attribution is wired for Stripe, Polar and Dodo. One script tag, no event plan needed on day one.
And accept that(5)
- It is web analytics, not product analytics. Page views, referrers, goals and revenue. No session replay, no feature flags, no cohorts over custom person properties. Pick PostHog if you need those.
- Attribution depends on one cookie. The checkout must carry the
datafast_visitor_idfrom the same browser that visited, which is what thecheckout-attributionslot does. Payments made on another device, or before consent, land as direct traffic. - Goal parameters are capped at 10 per event and 255 characters per value, all stored as strings. Typed properties are converted for you; numbers you want to sum belong in your database.
- Every goal counts toward your monthly event quota. Track decisions, not every click.
- The script writes a first-party cookie for a year. In the EU and the UK that needs consent.
src/lib/analytics/consent.tsships a gate you must switch on before you serve traffic there.
Pick PostHog when
Product teams who want funnels, retention, replay, flags, experiments and surveys on one event stream. One stream means one definition of "active user", not four. Good for early-stage teams, and SQL access answers the questions the dashboards cannot.
And accept that(5)
- The client bundle is not free.
posthog-jswith autocapture, replay and flags is a large third-party script, loaded on every page. Lazy loading and turning autocapture off are the two levers that matter. - Ad blockers block it by default. PostHog says a reverse proxy typically lifts event capture by 10 to 30%, which is why this battery installs one.
- Autocapture cuts both ways. It gives you data before you instrument anything, and it fills your project with
$autocaptureevents nobody can explain six months later. This battery captures named events on purpose and keeps autocapture as a backstop. - Anonymous events are cheap, identified events are not. Person profiles drive the analytics price, which is why the client runs with
person_profiles: "identified_only". - It is a warehouse of behaviour, not a source of truth for money. Revenue, entitlements and anything you would argue with a customer about belong in your database. PostHog is where you ask questions about them.
Questions people actually ask
- Should I choose DataFast or PostHog?
- DataFast is best for indie hackers and small SaaS teams who want one answer: which referrer, campaign or page produced revenue. Checkout attribution is wired for Stripe, Polar and Dodo. One script tag, no event plan needed on day one. PostHog is best for product teams who want funnels, retention, replay, flags, experiments and surveys on one event stream. One stream means one definition of "active user", not four. Good for early-stage teams, and SQL access answers the questions the dashboards cannot. Both fill the analytics slot, so a generated repo carries one or the other, never both.
- How much do DataFast and PostHog cost?
- DataFast: No free plan. A 14-day trial with no card. Starter is $9/month (1 site, 1 team member) and Growth $19/month (30 sites, 30 team members), both at 10k monthly events. Go over and tracking continues, but you must upgrade to open the dashboard. API, CLI and MCP access are on both plans. PostHog: Free every month, card or not: 1M analytics events, 5,000 session recordings and 1M feature flag requests. Past that, each product bills by usage, and you can set a billing limit per product. Self-hosting exists, but PostHog does not support it.
- What changes in my repo if I switch from DataFast to PostHog?
- DataFast writes 10 files, 4 environment variables and 1 dependency, and installs 3 path-scoped rules, 1 skill and 6 solution docs. PostHog writes 6 files, 3 environment variables and 3 dependencies, and installs 3 path-scoped rules, 2 skills and 5 solution docs.
Decide once, then build the repo that already knows the decision.
Either way you get that choice’s rules, skills and solution docs installed, plus the guard hooks, an onboarding doc for exactly these env vars, and the Compound Engineering loop. Free and MIT.