Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: posthog #299

Merged
merged 4 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ BYPASS_TOKEN=

VITE_HTTPS_ENABLED=true

SESSION_SECRET_KEY=
SESSION_SECRET_KEY=

PUBLIC_POSTHOG_PROJECT_TOKEN=
14 changes: 14 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"@significa/svelte-ui": "^0.0.28",
"@storyblok/js": "^2.3.0",
"matter-js": "^0.19.0",
"posthog-js": "^1.96.1",
"prism-svelte": "^0.5.0",
"svelte-confetti": "^1.3.0"
}
Expand Down
16 changes: 14 additions & 2 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,32 @@
import '$styles/index.css';

import { page } from '$app/stores';
import { beforeNavigate } from '$app/navigation';
import { browser, dev } from '$app/environment';

import DraftMode from '$components/draft-mode.svelte';
import ImageGallery from '$components/image-gallery.svelte';
import TopNavigation from '$components/top-navigation.svelte';
import PageDrawer from '$components/page-drawer.svelte';
import Footer from '$components/footer.svelte';

import { PUBLIC_POSTHOG_PROJECT_TOKEN } from '$env/static/public';

import { toast, Toaster, ToastNotification } from '@significa/svelte-ui';
import { beforeNavigate } from '$app/navigation';
import { dev } from '$app/environment';
import posthog from 'posthog-js';

export let data;

beforeNavigate(() => {
toast.clearAll();
});

if (browser) {
posthog.init(PUBLIC_POSTHOG_PROJECT_TOKEN, {
api_host: 'https://eu.posthog.com',
persistence: 'localStorage'
});
}
</script>

<svelte:head>
Expand Down