File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -70,9 +70,33 @@ function initializeReo() {
7070 document . head . appendChild ( reoScript ) ;
7171}
7272
73+ function configurePostHog ( ) {
74+ if ( isLocalhost ) {
75+ console . log ( '[custom.js] Skipping PostHog configuration on localhost' ) ;
76+ return ;
77+ }
78+
79+ // Wait for PostHog to be initialized by Fern
80+ const checkPostHog = setInterval ( ( ) => {
81+ if ( typeof window . posthog !== 'undefined' ) {
82+ clearInterval ( checkPostHog ) ;
83+
84+ // Configure cross-domain tracking
85+ window . posthog . set_config ( {
86+ cross_subdomain_cookie : true ,
87+ cross_domain : '.vapi.ai' ,
88+ persistence : 'localStorage+cookie'
89+ } ) ;
90+
91+ }
92+ } , 100 ) ;
93+
94+ }
95+
7396function initializeAll ( ) {
7497 initializeHockeyStack ( ) ;
7598 initializeReo ( ) ;
99+ configurePostHog ( ) ;
76100 if ( ENABLE_VOICE_WIDGET ) {
77101 injectVapiWidget ( ) ;
78102 }
You can’t perform that action at this time.
0 commit comments