File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727 "i18next-http-backend" : " ^3.0.2" ,
2828 "inflection" : " ^3.0.2" ,
2929 "luxon" : " ^3.7.2" ,
30+ "posthog-js" : " ^1.270.1" ,
3031 "prop-types" : " ^15.8.1" ,
3132 "react" : " ^19.1.1" ,
3233 "react-dom" : " ^19.1.1" ,
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ export const defaultValue = {
99 env : {
1010 VITE_SITE_TITLE : import . meta. env . VITE_SITE_TITLE ,
1111 VITE_FEATURE_REGISTRATION : import . meta. env . VITE_FEATURE_REGISTRATION ,
12+ VITE_PUBLIC_POSTHOG_KEY : import . meta. env . VITE_PUBLIC_POSTHOG_KEY ,
13+ VITE_PUBLIC_POSTHOG_HOST : import . meta. env . VITE_PUBLIC_POSTHOG_HOST ,
1214 } ,
1315} ;
1416
Original file line number Diff line number Diff line change @@ -2,20 +2,31 @@ import React from 'react';
22import { createRoot , hydrateRoot } from 'react-dom/client' ;
33import { BrowserRouter } from 'react-router' ;
44import { createHead , UnheadProvider } from '@unhead/react/client' ;
5+ import { PostHogProvider } from 'posthog-js/react' ;
56
67import App from './App' ;
78import { defaultValue } from './StaticContext' ;
89import StaticContextProvider from './StaticContextProvider' ;
910
11+ const staticContext = { ...defaultValue , ...window . STATIC_CONTEXT } ;
12+
13+ const posthogOptions = {
14+ cookieless_mode : 'always' ,
15+ api_host : staticContext . env . VITE_PUBLIC_POSTHOG_HOST ,
16+ defaults : '2025-05-24' ,
17+ } ;
18+
1019const head = createHead ( ) ;
1120
1221const container = document . getElementById ( 'root' ) ;
1322const app = (
14- < StaticContextProvider value = { { ... defaultValue , ... window . STATIC_CONTEXT } } >
23+ < StaticContextProvider value = { staticContext } >
1524 < UnheadProvider head = { head } >
16- < BrowserRouter >
17- < App />
18- </ BrowserRouter >
25+ < PostHogProvider apiKey = { staticContext . env . VITE_PUBLIC_POSTHOG_KEY } options = { posthogOptions } >
26+ < BrowserRouter >
27+ < App />
28+ </ BrowserRouter >
29+ </ PostHogProvider >
1930 </ UnheadProvider >
2031 </ StaticContextProvider >
2132) ;
You can’t perform that action at this time.
0 commit comments