-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): web analytics from posthog (#1260)
- Loading branch information
1 parent
0fa5f1c
commit fd8ab51
Showing
3 changed files
with
27 additions
and
2 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
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,21 @@ | ||
"use client" | ||
|
||
import posthog from "posthog-js" | ||
import { PostHogProvider } from "posthog-js/react" | ||
|
||
if ( | ||
typeof window !== "undefined" && | ||
process.env.NEXT_PUBLIC_POSTHOG_KEY && | ||
process.env.NEXT_PUBLIC_POSTHOG_HOST | ||
) { | ||
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, { | ||
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST, | ||
person_profiles: "always" | ||
}) | ||
} | ||
|
||
export const CSPostHogProvider = ({ | ||
children | ||
}: { | ||
children: React.ReactNode | ||
}) => <PostHogProvider client={posthog}>{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