PostHog
Product analytics and feature flags
git clone https://github.com/bijectionhq/posthog.git
cd posthog
git checkout 5fcadbc07c351596f783d27070d556a46658de67
cd packages/convexBijection repository access is required. Request access.
Description
Product analytics and feature flags
Explore the package README for API concepts, configuration, and examples. Check the Bijection source for adaptation-specific setup.
Review the source and its dependencies before adopting this package. Source availability does not establish npm publication or runtime qualification.
Getting started
- Get the source at the revision above and read its package documentation.
- Check the required Bijection SDK version, dependencies, and external service credentials.
- Follow the package setup instructions and the guide to using components.
- Exercise the component in your deployment according to your project’s verification rules.
Open source
Maintained source: bijectionhq/posthog. Based on PostHog/posthog-js. License: MIT. Consult the repository for license terms, notices, and contributor attribution.
From the upstream publisher
Capture analytics events, track exceptions, and evaluate feature flags with PostHog from your Convex backend.
Explore the demo ↗Demo video
Upstream overview
From the upstream package documentation.
The PostHog Convex package integrates PostHog analytics and feature flags directly into your Convex backend. It enables event tracking, product analytics, and feature flag evaluation from within Convex functions without requiring client-side instrumentation for backend events. This is the official PostHog library for Convex, maintained by the PostHog team.
Use cases
From the upstream package documentation.
- Tracking server-side events from Convex mutations and actions, such as user signups, purchases, or data changes, without relying on client-side tracking
- Evaluating PostHog feature flags inside Convex functions to gate backend logic or return different data based on flag state
- Capturing analytics for LLM or AI workflows running in Convex actions, where client-side SDKs cannot reach
- Sending structured logs and error tracking data from Convex backend functions to PostHog for observability
- Instrumenting multi-step backend pipelines with product analytics events to understand funnel performance at the server level
How it works
From the upstream package documentation.
Install the package with npm install @posthog/convex and configure it with your PostHog project API key. The library is designed to be used inside Convex functions, including queries, mutations, and actions, giving you access to PostHog's event capture and feature flag APIs from the server context.
Feature flag evaluation and event capture happen via the PostHog API, which means actions are the appropriate function type when network calls are required, since Convex queries and mutations cannot perform arbitrary fetch requests. The package abstracts the PostHog API surface so you can call it using familiar PostHog SDK patterns without managing HTTP requests manually.
Full SDK usage examples and configuration options are maintained in the official PostHog documentation at posthog.com/docs/libraries/convex, which is kept up to date alongside the package. A working demo is available at the linked example in the PostHog monorepo.
Upstream package FAQ
Does @posthog/convex work with both mutations and actions?
@posthog/convex can be used in both Convex mutations and actions to track events and check feature flags. Since it integrates with PostHog's server-side APIs, it works in any Convex function context.
How does PostHog integration affect Convex function performance?
The @posthog/convex component makes HTTP requests to PostHog's APIs, which adds network latency to your functions. Consider using it in actions rather than mutations for time-sensitive operations, or implement async event tracking patterns.
Can I use PostHog feature flags to control database queries in Convex?
Yes, @posthog/convex allows you to check feature flags within your Convex functions to conditionally execute different database queries or business logic. This enables server-side experimentation with your data layer.
Do I need PostHog client-side tracking if I use this component?
@posthog/convex provides server-side tracking only and complements client-side PostHog integration. You typically use both together for comprehensive analytics covering frontend interactions and backend operations.
Use with agents and CLI
Give your coding agent the component’s source identity and setup guidance.
Help me integrate PostHog with Bijection.
Read: https://bijection.com/components/posthog/SKILL.md
Check SDK compatibility and dependency availability.
Follow this project's execution and verification rules.Upstream README.md
View repository ↗Documentation from PostHog/posthog-js, recorded October 23, 2026. APIs and setup may differ in the Bijection adaptation.
PostHog Convex package
Please see the main PostHog docs.
SDK usage examples and code snippets live in the official documentation so they stay up to date.