Skip to content

Commit

Permalink
fix(docs): Pageview
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbraemer committed Dec 1, 2023
1 parent e8ea59d commit 6b6ff30
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
26 changes: 26 additions & 0 deletions .web/docs/.vitepress/theme/components/Layout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script setup>
import DefaultTheme from 'vitepress/theme'
import {useRouter} from 'vitepress';
import {watch} from 'vue';
import MeetTeam from "./MeetTeam.vue";
const {Layout} = DefaultTheme
const router = useRouter();
// Only run this on the client. Not during build
if (typeof window !== 'undefined' && window.posthog) {
watch(() => router.route.data.relativePath, (path) => {
posthog.capture("$pageview");
}, {immediate: true});
}
</script>

<template>
<Layout>
<template #home-features-after>
<MeetTeam/>
</template>
</Layout>
</template>
8 changes: 2 additions & 6 deletions .web/docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import DefaultTheme from 'vitepress/theme'
import type { Theme } from 'vitepress'
import { h } from 'vue'
import './styles/vars.css'
import VPBadge from 'vitepress/dist/client/theme-default/components/VPBadge.vue'
import MeetTeam from "./components/MeetTeam.vue";
import Layout from "./components/Layout.vue";

export default {
extends: DefaultTheme,
Layout() {
return h(DefaultTheme.Layout, null, {
'home-features-after': () => h(MeetTeam),
})
},
Layout: Layout,
enhanceApp({ app }) {
// app.component('TextAndImage', SvgImage)
app.component('VPBadge', VPBadge)
Expand Down
3 changes: 3 additions & 0 deletions .web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"devDependencies": {
"vitepress": "^1.0.0-rc.31",
"vue": "^3.3.4"
},
"dependencies": {
"posthog-js": "^1.93.3"
}
}
17 changes: 17 additions & 0 deletions .web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "connect-minekube-docs@workspace:."
dependencies:
posthog-js: "npm:^1.93.3"
vitepress: "npm:^1.0.0-rc.31"
vue: "npm:^3.3.4"
languageName: unknown
Expand Down Expand Up @@ -1304,6 +1305,13 @@ __metadata:
languageName: node
linkType: hard

"fflate@npm:^0.4.1":
version: 0.4.8
resolution: "fflate@npm:0.4.8"
checksum: 29d1eddaaa5deab61b1c6b0d21282adacadbc4d2c01e94d8b1ee784398151673b9c563e53f97a801bc410a1ae55e8de5378114a743430e643e7a0644ba8e5a42
languageName: node
linkType: hard

"focus-trap@npm:^7.5.4":
version: 7.5.4
resolution: "focus-trap@npm:7.5.4"
Expand Down Expand Up @@ -1961,6 +1969,15 @@ __metadata:
languageName: node
linkType: hard

"posthog-js@npm:^1.93.3":
version: 1.93.3
resolution: "posthog-js@npm:1.93.3"
dependencies:
fflate: "npm:^0.4.1"
checksum: b2dab9ee4df1ce86e937773f8c2b4f99350bdf50af0cd23bd8a60172b3b10d73bc6c11520eae6b81cde931e39d040d79cad46ad191648f370b662771799b475e
languageName: node
linkType: hard

"preact@npm:^10.0.0":
version: 10.13.2
resolution: "preact@npm:10.13.2"
Expand Down

0 comments on commit 6b6ff30

Please sign in to comment.