11'use client'
2- import { NEXT_PUBLIC_POSTHOG_PAPIK , NEXT_PUBLIC_POSTHOG_UI_HOST , NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED } from '@/lib/environment.client'
2+ import { NEXT_PUBLIC_POSTHOG_PAPIK , NEXT_PUBLIC_POSTHOG_UI_HOST , NEXT_PUBLIC_SOURCEBOT_TELEMETRY_DISABLED , NEXT_PUBLIC_PUBLIC_SEARCH_DEMO } from '@/lib/environment.client'
33import posthog from 'posthog-js'
44import { PostHogProvider } from 'posthog-js/react'
55import { resolveServerPath } from './api/(client)/client'
@@ -14,10 +14,10 @@ if (typeof window !== 'undefined') {
1414 api_host : posthogHostPath ,
1515 ui_host : NEXT_PUBLIC_POSTHOG_UI_HOST ,
1616 person_profiles : 'identified_only' ,
17- capture_pageview : false , // Disable automatic pageview capture
17+ capture_pageview : NEXT_PUBLIC_PUBLIC_SEARCH_DEMO , // @nocheckin Disable automatic pageview capture if we're not in public demo mode
1818 autocapture : false , // Disable automatic event capture
1919 // eslint-disable-next-line @typescript-eslint/no-explicit-any
20- sanitize_properties : ( properties : Record < string , any > , _event : string ) => {
20+ sanitize_properties : ! NEXT_PUBLIC_PUBLIC_SEARCH_DEMO ? ( properties : Record < string , any > , _event : string ) => {
2121 // https://posthog.com/docs/libraries/js#config
2222 if ( properties [ '$current_url' ] ) {
2323 properties [ '$current_url' ] = null ;
@@ -27,7 +27,7 @@ if (typeof window !== 'undefined') {
2727 }
2828
2929 return properties ;
30- }
30+ } : undefined
3131 } ) ;
3232 } else {
3333 console . log ( "PostHog telemetry disabled" ) ;
0 commit comments