Analytics
Learn how to set up and use PostHog and Plausible analytics
Dirstarter uses two analytics tools for different purposes:
- PostHog - For user behavior tracking and event analytics
- Plausible - For privacy-friendly website analytics
While they are recommended, you can use any other analytics tool you want.
PostHog
PostHog is used for detailed user behavior tracking and event analytics. It's particularly useful for:
- Tracking user interactions (clicks, form submissions)
- Monitoring conversion rates
- Analyzing user flows
- Custom event tracking
Setup
- Create a PostHog account at posthog.com
- Create a new project
- Get your API key from Project Settings > Project API Key
- Add the following environment variables:
Configuration
PostHog is configured with the following settings:
Usage
The boilerplate automatically tracks:
- Page views (via
PosthogPageview
component) - External link clicks
- Newsletter subscriptions
- Tool submissions
- Stripe checkout events
To track custom events:
Plausible
Plausible is used for privacy-friendly website analytics. It's particularly useful for:
- Basic website traffic metrics
- Page view statistics
- Visitor demographics
- No cookie consent required
Setup
- Create a Plausible account at plausible.io
- Add your website
- Get your domain and API key
- Add the following environment variables:
Usage
The boilerplate automatically includes the Plausible script in the root layout:
Admin Dashboard Integration
The admin dashboard includes an analytics card that shows:
- Total visitors (30-day period)
- Average daily visitors
- Visitor trends
Why Two Separate Tools?
The boilerplate uses both tools for different purposes:
- PostHog: Detailed user behavior tracking, conversion monitoring, and custom event tracking
- Plausible: Privacy-friendly basic analytics that don't require cookie consent
This combination provides:
- Comprehensive analytics for business insights (PostHog)
- Privacy-friendly basic metrics (Plausible)
- GDPR compliance through Plausible's cookie-free approach
- Detailed user behavior analysis through PostHog
Edit on GitHub
Last updated on