Wraps children with PostHog analytics provider if enabled, otherwise renders children directly. Ensures analytics are only loaded when configured.
export function PHProvider({ children }: { children: React.ReactNode }) {
if (!isPostHogEnabled) {
return children
}
return <PostHogProvider client={posthog}>{children}</PostHogProvider>
}
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key