Skip to content

Commit

Permalink
posthog
Browse files Browse the repository at this point in the history
  • Loading branch information
catdevnull committed Feb 5, 2025
1 parent ed82aa7 commit 3c9f42c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sitio-sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"date-fns": "^4.1.0",
"dayjs": "^1.11.13",
"mode-watcher": "^0.5.0",
"postgres": "^3.4.5"
"postgres": "^3.4.5",
"posthog-js": "^1.215.3"
}
}
33 changes: 33 additions & 0 deletions sitio-sveltekit/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions sitio-sveltekit/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<script lang="ts">
import { MediaQuery } from 'svelte/reactivity';
import '../app.css';
import posthog from 'posthog-js';
import { browser } from '$app/environment';
let { children } = $props();
const dark = new MediaQuery('prefers-color-scheme: dark');
Expand All @@ -11,6 +15,16 @@
document.documentElement.classList.remove('dark');
}
});
$effect(() => {
if (browser) {
posthog.init('phc_rZpVo1fOZZutITBd4iAXRbGu4Zpng0y7lpOUgk9Fizk', {
api_host: 'https://us.i.posthog.com',
person_profiles: 'identified_only' // or 'always' to create profiles for anonymous users as well
});
}
return;
});
</script>

<svelte:head>
Expand Down

0 comments on commit 3c9f42c

Please sign in to comment.