Skip to content

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.

DataFast compared with PostHog on pricing, fit, trade-offs, required companions, environment variables, dependencies, MCP servers and repo footprint.
From the manifestOption ADataFastOption BPostHog
In one lineDataFast

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.

PricingDataFast

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 forDataFast

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 manifestDataFast
  • 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_id from the same browser that visited, which is what the checkout-attribution slot 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.ts ships a gate you must switch on before you serve traffic there.
PostHog
  • The client bundle is not free. posthog-js with 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 $autocapture events 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.
Required companionsAdded for you, with a reasonDataFast

Nothing. It stands on its own.

PostHog

Nothing. It stands on its own.

Recommended alongsideSuggested, never added for youDataFast
  • A payments battery
PostHog
  • An error tracking battery
Env vars you will manageEvery one documented in docs/onboard.mdDataFast

4 variables · 1 required

  • NEXT_PUBLIC_DATAFAST_WEBSITE_ID
  • DATAFAST_API_KEY
  • NEXT_PUBLIC_DATAFAST_ALLOW_LOCALHOST
  • NEXT_PUBLIC_DATAFAST_DOMAIN
PostHog

3 variables · 2 required

  • NEXT_PUBLIC_POSTHOG_HOST
  • NEXT_PUBLIC_POSTHOG_KEY
  • POSTHOG_API_KEY
Dependencies addedDataFast
  • server-only ^0.0.1
PostHog
  • posthog-js ^1.434.0
  • posthog-node ^5.54.0
  • server-only ^0.0.1
MCP serversWritten into .mcp.jsonDataFast
  • datafast: https://datafa.st/api/mcp
PostHog
  • posthog: https://mcp.posthog.com/mcp?readonly=true
Footprint in your repoDataFast

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

.env.localbash7 lines
# 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

.env.localbash6 lines
# 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)

PostHog (5)

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_id from the same browser that visited, which is what the checkout-attribution slot 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.ts ships 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-js with 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 $autocapture events 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.