Skip to content

Commit ec962ee

Browse files
committed
fixing error
1 parent b98140f commit ec962ee

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

fern/custom.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,33 @@ function initializeReo() {
7070
document.head.appendChild(reoScript);
7171
}
7272

73+
function configurePostHog() {
74+
if (isLocalhost) {
75+
console.log('[custom.js] Skipping PostHog configuration on localhost');
76+
return;
77+
}
78+
79+
// Wait for PostHog to be initialized by Fern
80+
const checkPostHog = setInterval(() => {
81+
if (typeof window.posthog !== 'undefined') {
82+
clearInterval(checkPostHog);
83+
84+
// Configure cross-domain tracking
85+
window.posthog.set_config({
86+
cross_subdomain_cookie: true,
87+
cross_domain: '.vapi.ai',
88+
persistence: 'localStorage+cookie'
89+
});
90+
91+
}
92+
}, 100);
93+
94+
}
95+
7396
function initializeAll() {
7497
initializeHockeyStack();
7598
initializeReo();
99+
configurePostHog();
76100
if (ENABLE_VOICE_WIDGET) {
77101
injectVapiWidget();
78102
}

fern/docs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ analytics:
9696
posthog:
9797
api-key: ${POSTHOG_PROJECT_API_KEY}
9898
endpoint: https://us.i.posthog.com
99-
cross-subdomain-tracking: true
100-
cross-domain: .vapi.ai
10199
ga4:
102100
measurement-id: G-BVPB7XB842
103101
navigation:

0 commit comments

Comments
 (0)