-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add is production config along with production url (#39)
- Loading branch information
1 parent
dd47a76
commit 8e8567a
Showing
12 changed files
with
66 additions
and
54 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
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
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
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
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 |
---|---|---|
@@ -1,33 +1,27 @@ | ||
'use client'; | ||
|
||
import { config } from '@/config'; | ||
import { clientEnv } from '@/env/client-env'; | ||
import posthog from 'posthog-js'; | ||
import { PostHogProvider } from 'posthog-js/react'; | ||
import { useEffect } from 'react'; | ||
|
||
if (config.areAnalyticsEnabled && typeof window !== 'undefined') { | ||
posthog.init(clientEnv.NEXT_PUBLIC_POSTHOG_KEY, { | ||
api_host: '/_proxy/a', | ||
ui_host: 'https://eu.posthog.com', | ||
person_profiles: 'identified_only', | ||
capture_pageview: false, | ||
capture_pageleave: true, | ||
loaded: (posthog) => { | ||
if (clientEnv.NEXT_PUBLIC_VERCEL_ENV === 'development') | ||
posthog.debug(true); | ||
}, | ||
}); | ||
} | ||
|
||
interface AnalyticsProviderProps { | ||
children: React.ReactNode; | ||
enabled?: boolean; | ||
} | ||
export function AnalyticsProvider({ | ||
children, | ||
enabled = false, | ||
}: AnalyticsProviderProps) { | ||
useEffect(() => { | ||
if (enabled && typeof window !== 'undefined') { | ||
posthog.init(clientEnv.NEXT_PUBLIC_POSTHOG_KEY, { | ||
api_host: '/_proxy/posthog', | ||
ui_host: 'https://eu.posthog.com', | ||
person_profiles: 'identified_only', | ||
capture_pageview: false, | ||
capture_pageleave: true, | ||
loaded: (posthog) => { | ||
if (clientEnv.NEXT_PUBLIC_VERCEL_ENV === 'development') | ||
posthog.debug(true); | ||
}, | ||
}); | ||
} | ||
}, [enabled]); | ||
|
||
export function AnalyticsProvider({ children }: AnalyticsProviderProps) { | ||
return <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
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