Analytics tell you what people do in your app. In this repo, analytics are
provider-agnostic, which means the app can send the same events to one
provider or multiple providers without changing feature code.
What Analytics Mean Here
At a basic level, analytics answer questions like:- how many people visited the app
- which pages they opened
- which buttons they clicked
- which flows they completed
What The Repo Already Gives You
The analytics system includes:- an analytics provider at the app root
- shared event helpers
- shared pageview tracking
- support for one provider or multiple providers
- a clean disabled mode with
none
trackAnalyticsEvent()trackAnalyticsPageview()identifyAnalyticsUser()
Choose Your Analytics Provider
One Provider
Multiple Providers
Disable Analytics
Which Provider Should You Pick?
PostHog
Good if you want:- full product analytics
- more advanced tracking later
- one strong default provider
Plausible
Good if you want:- simpler privacy-friendly analytics
- lightweight pageview tracking
- a smaller tool than PostHog
DataFast
Good if you want:- basic pageviews and goals
- a small setup surface
- lightweight analytics
How To Set It Up
- Create an account with the analytics provider you want
- Create a site/project inside that provider
- Copy the provider keys or script settings
- Add the env vars to
.env.local - Restart the app
- Open the app and browse a few pages
- Confirm the events appear in the provider dashboard
How The Repo Is Wired
The main files are:lib/analytics/provider.tsxlib/analytics/client.tslib/analytics/providers/*
Verification Checklist
Your analytics setup is working if:- the provider script loads
- pageviews appear in the dashboard
- custom events appear after you trigger tracked actions
Common Mistakes
- typo in
NEXT_PUBLIC_ANALYTICS_PROVIDER - forgetting to restart after editing env vars
- wrong Plausible domain
- missing DataFast website ID
- trying multiple providers before one provider works
Meta Ads
Read the separate guide for optional Meta checkout attribution.

