-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FET-1721: Implement posthog (hosted)
- Loading branch information
Stanislav Lysak
committed
Dec 13, 2024
1 parent
d385c3a
commit 82b9cea
Showing
5 changed files
with
158 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
|
||
import { PostHogConfig } from 'posthog-js' | ||
|
||
export const posthogConfig: { | ||
apiKey: string | ||
options: Partial<PostHogConfig> | ||
} = { | ||
apiKey: process.env.NEXT_PUBLIC_POSTHOG_KEY!, | ||
options: { | ||
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST, | ||
person_profiles: 'identified_only', // or 'always' to create profiles for anonymous users as well | ||
autocapture: true, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use client' | ||
|
||
import { PostHogProvider } from 'posthog-js/react' | ||
|
||
import { posthogConfig } from './config' | ||
|
||
export function Posthog({ children }: React.PropsWithChildren) { | ||
return ( | ||
<PostHogProvider apiKey={posthogConfig.apiKey} options={posthogConfig.options}> | ||
{children} | ||
</PostHogProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters