Add privacy-friendly analytics and product insights to any website or app
Complete analytics setup with traffic data (Plausible) and product behavior data (PostHog) - no cookie banners needed.
Plausible handles traffic analytics (pageviews, referrers, top pages, countries) in a lightweight, privacy-friendly script. PostHog handles product analytics (user journeys, feature usage, session replay, funnels). Together they give you the full picture.
Add Plausible's lightweight script to get real-time traffic data without cookies.
of your site (or use your framework's head component)app/layout.tsx using the Script component<script defer data-domain="yourdomain.com"
src="https://plausible.io/js/script.js"></script>
import Script from 'next/script'
export default function Layout({ children }) {
return (
<html>
<head>
<Script defer data-domain="yourdomain.com"
src="https://plausible.io/js/script.js" />
</head>
<body>{children}</body>
</html>
)
}
Track specific actions like signups, purchases, and button clicks.
// Track a signup event
plausible("Signup")
// Track with custom properties
plausible("Purchase", { props: { plan: "pro", amount: "29" } })
// Example: track button click
document.getElementById("cta").addEventListener("click", () => {
plausible("CTA Click")
})
Add PostHog for deeper product insights: user journeys, session replay, and feature flags.
npm install posthog-js and initialize in your app<script>
!function(t,e){var o,n,p,r;e.__SV||(global.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,global.posthog||[]);
posthog.init('YOUR_API_KEY', {api_host: 'https://app.posthog.com'})
</script>
// src/app/providers.tsx
'use client'
import posthog from 'posthog-js'
import { PostHogProvider } from 'posthog-js/react'
import { useEffect } from 'react'
export function PHProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
api_host: 'https://app.posthog.com'
})
}, [])
return <PostHogProvider client={posthog}>{children}</PostHogProvider>
}
Capture key product events and build conversion funnels.
import posthog from 'posthog-js'
// Track a signup
posthog.capture('user_signed_up', { method: 'google' })
// Track a feature usage
posthog.capture('feature_used', { feature: 'ai_chat', plan: 'pro' })
// Identify a user (links events to a person)
posthog.identify(userId, { email: user.email, plan: 'pro' })
Complete analytics setup with traffic data (Plausible) and product behavior data (PostHog) - no cookie banners needed.
Get a step-by-step checklist, setup order, and the exact config for every tool in this guide. Or let me build it for you.
Get the checklist → Want this built for you?