Analytics
We have three analytics libraries in next-forge.
Vercel Web Analytics
Vercel's built-in analytics tool offers detailed insights into your website's visitors with new metrics like top pages, top referrers, and demographics. All you have to do to enable it is visit the Analytics tab in your Vercel project and click Enable from the dialog.
Read more about it here.
Google Analytics
Google Analytics tracks user behavior, page views, session duration, and other engagement metrics to provide insights into user activity and marketing effectiveness. GA tracking code is injected using @next/third-parties for performance reasons.
To enable it, simply add a NEXT_PUBLIC_GOOGLE_ANALYTICS_ID
environment variable to your project.
PostHog
PostHog is a single platform to analyze, test, observe, and deploy new features. It comes with lots of products, including a web analytics tool, event analytics, feature flagging, and more.
Web Analytics
PostHog's web analytics tool is enabled by default and captures pageviews, pageleave and custom events.
Product Analytics
We've combined PostHog's Node.js server-side library with Clerk and Stripe webhooks to wire it up as follows:
We've also setup Next.js rewrites to reverse proxy PostHog requests, meaning your client-side analytics events won't be blocked by ad blockers.
Session Replay
PostHog's session replays let you see exactly what users do on your site. It records console logs and network errors, and captures performance data like resource timings and blocked requests. This is disabled by default, so make sure you enable it in your project settings.