Skip to content

Commit

Permalink
Merge pull request #1619 from appwrite/posthog-cleanup
Browse files Browse the repository at this point in the history
identify all events
  • Loading branch information
thejessewinton authored Jan 9, 2025
2 parents 1638770 + 3291b81 commit 335ae3e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@appwrite.io/pink": "~0.26.0",
"@appwrite.io/pink-icons": "~0.26.0",
"@appwrite.io/repo": "github:appwrite/appwrite#1.6.x",
"@fingerprintjs/fingerprintjs": "^4.5.1",
"@internationalized/date": "3.5.0",
"@melt-ui/pp": "^0.3.2",
"@melt-ui/svelte": "^0.86.0",
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

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

8 changes: 7 additions & 1 deletion src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ import { getAllChangelogEntries } from './changelog/utils';
import { browser } from '$app/environment';
import posthog from 'posthog-js';
import { PUBLIC_POSTHOG_API_KEY } from '$env/static/public';
import fpPromise from '@fingerprintjs/fingerprintjs';

export const prerender = true;
export const trailingSlash = 'never';

export const load = async () => {
if (browser) {
const fp = await fpPromise.load();
const { visitorId: distinct_id } = await fp.get();

posthog.init(PUBLIC_POSTHOG_API_KEY, {
api_host: 'https://eu.i.posthog.com',
person_profiles: 'identified_only',
person_profiles: 'always',
persistence: 'memory'
});

posthog.identify(distinct_id);
}

return {
Expand Down

0 comments on commit 335ae3e

Please sign in to comment.