Skip to content

Commit

Permalink
feat: add posthog analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewStoian committed Dec 16, 2024
1 parent 8a677c1 commit 7407d0f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import enterpriseSidebar from './src/content/sidebars/enterprise.ts';
import developerSidebar from './src/content/sidebars/developer.ts';

import customConsentScript from './src/scripts/custom-consent-mode.js?raw';
import postHogScript from './src/scripts/posthog.js?raw';
import gtmScript from './src/scripts/gtm.js?raw';

let site;
Expand Down Expand Up @@ -73,6 +74,13 @@ const config = defineConfig({
tag: 'script',
content: customConsentScript,
},
// PostHog
{
tag: 'script',
content: process.env.VERCEL_ENV === 'production'
? postHogScript.replace('<POSTHOG_CLIENT_API_HOST>', process.env.POSTHOG_CLIENT_API_HOST).replace('<POSTHOG_PROJECT_API_KEY>', process.env.POSTHOG_PROJECT_API_KEY)
: undefined,
},
// Google Tag Manager
{
tag: 'script',
Expand Down
7 changes: 7 additions & 0 deletions src/scripts/posthog.js

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

0 comments on commit 7407d0f

Please sign in to comment.