-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathproviders.tsx
More file actions
33 lines (29 loc) · 924 Bytes
/
providers.tsx
File metadata and controls
33 lines (29 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use client';
import posthog from 'posthog-js';
import { PostHogProvider as PHProvider } from 'posthog-js/react';
import { useEffect, type FC, type ReactNode } from 'react';
import { ThemeProvider } from 'next-themes';
import PlausibleProvider from 'next-plausible';
interface ProvidersProps {
children: ReactNode;
}
export const Providers: FC<ProvidersProps> = ({ children }) => {
useEffect(() => {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
cookieless_mode: 'always',
api_host: '/ingest',
ui_host: 'https://us.posthog.com',
defaults: '2025-05-24',
capture_exceptions: true,
disable_compression: true,
debug: process.env.NODE_ENV === 'development',
});
}, []);
return (
<PHProvider client={posthog}>
<PlausibleProvider>
<ThemeProvider attribute="class">{children}</ThemeProvider>
</PlausibleProvider>
</PHProvider>
);
};