Skip to content

Commit

Permalink
feat: added posthog
Browse files Browse the repository at this point in the history
  • Loading branch information
umuthopeyildirim committed Dec 5, 2023
1 parent 43d6895 commit eadbe5d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ const config = {
customElement: 'amp-auto-ads',
},
],
clientModules: [require.resolve('./src/theme/voiceflow.js')],
clientModules: [
require.resolve('./src/theme/voiceflow.js'),
require.resolve('./src/theme/posthog.js'),
],
plugins: [
[
'@docusaurus/plugin-pwa',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"docusaurus2-dotenv": "^1.4.0",
"dotenv": "^16.3.1",
"firebase": "^10.6.0",
"posthog-js": "^1.93.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.12.0",
Expand Down
13 changes: 13 additions & 0 deletions pnpm-lock.yaml

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

9 changes: 9 additions & 0 deletions src/theme/posthog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import posthog from 'posthog-js';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';

if (ExecutionEnvironment.canUseDOM) {
posthog.init('phc_kj7SlNVSRxYPv0W8mvZtBGpANBWtWBT2HnWThsvCmhU', {
api_host: 'https://app.posthog.com',
});
posthog.capture('my event', {property: 'value'});
}

1 comment on commit eadbe5d

@vercel
Copy link

@vercel vercel bot commented on eadbe5d Dec 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.