mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
✨(all) support a dedicated domain for the PostHog feature flag API
Ad blockers recently started blocking requests to our PostHog feature flag API, leading to undesired behavior in the app. Following PostHog's documentation, allow configuring a dedicated domain for feature flags, isolated from the main PostHog domain.
This commit is contained in:
committed by
aleb_the_flash
parent
e42b083f20
commit
16ee575ff8
@@ -9,6 +9,7 @@ export interface ApiConfig {
|
||||
analytics?: {
|
||||
id: string
|
||||
host: string
|
||||
flags_api_host?: string
|
||||
}
|
||||
support?: {
|
||||
id: string
|
||||
|
||||
@@ -28,10 +28,16 @@ export const terminateAnalyticsSession = async () => {
|
||||
export type useAnalyticsProps = {
|
||||
id?: string
|
||||
host?: string
|
||||
flags_api_host?: string
|
||||
isDisabled?: boolean
|
||||
}
|
||||
|
||||
export const useAnalytics = ({ id, host, isDisabled }: useAnalyticsProps) => {
|
||||
export const useAnalytics = ({
|
||||
id,
|
||||
host,
|
||||
flags_api_host,
|
||||
isDisabled,
|
||||
}: useAnalyticsProps) => {
|
||||
const [location] = useLocation()
|
||||
const { user } = useUser()
|
||||
|
||||
@@ -39,9 +45,13 @@ export const useAnalytics = ({ id, host, isDisabled }: useAnalyticsProps) => {
|
||||
if (!id || !host || isDisabled) return
|
||||
getPosthog().then((ph) => {
|
||||
if (ph.__loaded) return
|
||||
ph.init(id, { api_host: host, person_profiles: 'always' })
|
||||
ph.init(id, {
|
||||
api_host: host,
|
||||
flags_api_host: flags_api_host,
|
||||
person_profiles: 'always',
|
||||
})
|
||||
})
|
||||
}, [id, host, isDisabled])
|
||||
}, [id, host, flags_api_host, isDisabled])
|
||||
|
||||
useEffect(() => {
|
||||
if (!user) return
|
||||
|
||||
Reference in New Issue
Block a user