Skip to content

Commit

Permalink
Enable PostHog Session replay
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyfok committed Jul 4, 2024
1 parent 0846e82 commit 041413f
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
export const prerender = true;
export const trailingSlash = 'always';

import posthog from 'posthog-js'
import "posthog-js/dist/recorder";
import "posthog-js/dist/surveys";
// import "posthog-js/dist/exception-autocapture";
import "posthog-js/dist/tracing-headers";
import "posthog-js/dist/web-vitals";
import posthog from 'posthog-js';

import { browser } from '$app/environment';

export const load = async () => {

if (browser) {
posthog.init(
'phc_gXl8K7Gu7YCBU5KH6sO8pFy0InNYRWngGdZ4o23KM07',
{ api_host: 'https://us.i.posthog.com' }
)
if (!window.location.host.includes('127.0.0.1') && !window.location.host.includes('localhost')) {
posthog.init('phc_gXl8K7Gu7YCBU5KH6sO8pFy0InNYRWngGdZ4o23KM07', {
api_host: 'https://us.i.posthog.com',
disable_external_dependency_loading: true // Optional - will ensure we never try to load extensions lazily
});
}
}
return
return;
};

export const _frontmatter = {}

0 comments on commit 041413f

Please sign in to comment.