From 41361077c9dcdeee2a689fb382e9d318648b703a Mon Sep 17 00:00:00 2001 From: gregor <gregor.schulz@holi.social> Date: Thu, 20 Feb 2025 08:47:46 +0100 Subject: [PATCH] disable posthog autocapture completely --- core/tracking/PosthogProvider.tsx | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/core/tracking/PosthogProvider.tsx b/core/tracking/PosthogProvider.tsx index cc5d5beda2..ca6c058b3b 100644 --- a/core/tracking/PosthogProvider.tsx +++ b/core/tracking/PosthogProvider.tsx @@ -3,26 +3,11 @@ import React, { PropsWithChildren } from 'react' import { featureFlagBootstrapValues } from '@holi/core/featureFlags/featureFlagBootstrapValues' import { posthogHost, posthogKey } from '@holi/core/helpers/config' -import { getConsentState } from '@holi/core/tracking/TrackingInitializer' -import { ConsentState } from '@holi/core/tracking/types' - -type RouteToPropertiesFilter = ((name: string, params: unknown) => Record<string, unknown>) | undefined export interface PosthogProviderProps { bootstrapState?: PostHogOptions['bootstrap'] } -const withNavigationAndConsentProperties: RouteToPropertiesFilter = (name, params) => { - const paramsProps = - typeof params === 'object' && params !== null /* null is an Object in JS */ - ? (params as Record<string, unknown>) - : {} - return { - ...paramsProps, - ...ConsentState.toEventProperties(getConsentState()), - } -} - const PosthogProvider = ({ children, bootstrapState = {} }: PropsWithChildren<PosthogProviderProps>) => { const posthog = new PostHog(posthogKey, { host: posthogHost, @@ -34,16 +19,7 @@ const PosthogProvider = ({ children, bootstrapState = {} }: PropsWithChildren<Po }, }) - return ( - <PostHogProvider - client={posthog} - autocapture={{ - navigation: { routeToProperties: withNavigationAndConsentProperties }, - }} - > - {children} - </PostHogProvider> - ) + return <PostHogProvider client={posthog}>{children}</PostHogProvider> } export default PosthogProvider -- GitLab