Skip to content

Commit fcdd95b

Browse files
committed
chore: Update plausible
1 parent e914676 commit fcdd95b

File tree

5 files changed

+28
-284
lines changed

5 files changed

+28
-284
lines changed

packages/mermaid/src/docs/.vitepress/components/EditorSelectionModal.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
22
import { onMounted, onUnmounted, ref } from 'vue';
3+
import { track } from '@plausible-analytics/tracker';
34
45
interface Feature {
56
iconUrl: string;
@@ -52,7 +53,8 @@ const editorColumns: EditorColumn[] = [
5253
description: 'Code only, no login',
5354
buttonText: 'Start free',
5455
buttonUrl: 'https://mermaid.live/edit',
55-
buttonClasses: 'bg-[#BEDDE3] hover:bg-[#5CA3B4] text-[#1E1A2E] hover:text-white hover:shadow-md',
56+
buttonClasses:
57+
'bg-[#BEDDE3] hover:bg-[#5CA3B4] text-[#1E1A2E] hover:text-white hover:shadow-md',
5658
features: openSourceFeatures,
5759
},
5860
];
@@ -67,6 +69,7 @@ const handleMouseDown = (e: MouseEvent) => {
6769
) {
6870
e.preventDefault();
6971
isVisible.value = !isVisible.value;
72+
track('editorSelectionModalOpen');
7073
}
7174
};
7275
@@ -82,7 +85,7 @@ onUnmounted(() => {
8285
<template>
8386
<div
8487
v-if="isVisible"
85-
class="fixed top-0 left-0 z-50 flex h-screen w-screen backdrop-blur-sm items-center justify-center bg-[#8585A4]/40 plausible-event-name=editorSelectionModalOpen"
88+
class="fixed top-0 left-0 z-50 flex h-screen w-screen backdrop-blur-sm items-center justify-center bg-[#8585A4]/40"
8689
@click.self="isVisible = false"
8790
>
8891
<div
@@ -115,7 +118,7 @@ onUnmounted(() => {
115118
'mb-6 flex h-10 w-full items-center justify-center rounded-xl',
116119
column.buttonClasses,
117120
'plausible-event-name=editorPick',
118-
`plausible-event-type=${column.id}`
121+
`plausible-event-type=${column.id}`,
119122
]"
120123
>
121124
{{ column.buttonText }}

packages/mermaid/src/docs/.vitepress/config.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,6 @@ export default defineConfig({
4848
'meta',
4949
{ property: 'og:image', content: 'https://mermaid.js.org/mermaid-logo-horizontal.svg' },
5050
],
51-
[
52-
'script',
53-
{
54-
defer: 'true',
55-
'data-domain': 'mermaid.js.org',
56-
// All tracked stats are public and available at https://p.mermaid.live/mermaid.js.org
57-
src: 'https://p.mermaid.live/js/script.tagged-events.outbound-links.js',
58-
},
59-
],
6051
],
6152
themeConfig: {
6253
logo: getHeaderLogo(docsHostname()),

packages/mermaid/src/docs/.vitepress/theme/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type { EnhanceAppContext } from 'vitepress';
1515
import Theme from 'vitepress/theme';
1616
import { h } from 'vue';
1717
import '../style/main.css';
18+
import { init } from '@plausible-analytics/tracker';
1819

1920
export default {
2021
...DefaultTheme,
@@ -29,6 +30,18 @@ export default {
2930
});
3031
},
3132
enhanceApp({ app, router }: EnhanceAppContext) {
33+
if (typeof window !== 'undefined') {
34+
init({
35+
domain: 'mermaid.js.org',
36+
// All tracked stats are public and available at https://p.mermaid.live/mermaid.js.org
37+
endpoint: 'https://p.mermaid.live/api/event',
38+
bindToWindow: true,
39+
// captureOnLocalhost: true,
40+
autoCapturePageviews: true,
41+
outboundLinks: true,
42+
});
43+
}
44+
3245
// register global components
3346
app.component('Mermaid', Mermaid);
3447
app.component('Contributors', Contributors);

packages/mermaid/src/docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"dependencies": {
1919
"@mdi/font": "^7.4.47",
20+
"@plausible-analytics/tracker": "^0.4.4",
2021
"@vueuse/core": "^13.9.0",
2122
"font-awesome": "^4.7.0",
2223
"jiti": "^2.4.2",

0 commit comments

Comments
 (0)