PostHog

PostHog is an open-source product analytics platform for tracking user behavior, session replays, feature flags, and A/B testing. It supports cookieless tracking, allowing analytics to continue even without cookie consent.

PostHog is an open-source product analytics platform that helps you understand user behavior, track events, and analyze product usage. Unlike traditional analytics tools, PostHog supports both cookieless and cookie-based tracking. This means you can sync c15t with PostHog and continue collecting analytics even when users haven't given consent—PostHog simply operates in cookieless mode until consent is granted.

PostHog SDK Implementation

This is the recommended approach if you're using the Posthog JS SDK, this is commonly used in React projects.

Adding the PostHog SDK to c15t

Initialize Posthog

When you initialize posthog make sure to set cookieless_mode to on_reject.

Adding the SDK callback to c15t

The PostHog SDK approach uses callbacks.onConsentSet instead of scripts. This lets you toggle PostHog's opt-in/opt-out based on the user's consent choice.

Info

See the integration overview for how to wrap this in your framework (React or Next.js). Pass the callbacks option to your ConsentManagerProvider the same way you would pass scripts.

PostHog Script Implementation

If you want to load posthog via a script tag it's recommended to use this approach.

By default c15t will always load the script regardless of consent. This is because the script has built-in functionality to opt into and out of tracking based on consent.

Initialize Posthog

This script does not load the Posthog script, it only syncs the consent state with Posthog via the Posthog JS SDK.

This is due to Posthog's use of cookieless tracking. However, you need to set cookieless_mode to on_reject when initializing Posthog.

Adding the script to c15t

Info

See the integration overview for how to pass scripts to your framework (JavaScript, React, or Next.js).

Types

PosthogConsentOptions

Loading…

Script

Loading…

Last modified on September 19, 2025