Skip to content

Commit 29bf994

Browse files
committed
feat: add custom event tracking
1 parent f5bebc0 commit 29bf994

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/demo/Demo.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useUrlSearchParams } from "@vueuse/core";
44
import { use } from "echarts/core";
55
import { CanvasRenderer, SVGRenderer } from "echarts/renderers";
66
import { INIT_OPTIONS_KEY } from "../ECharts";
7+
import va from "@vercel/analytics";
78
89
import LogoChart from "./examples/LogoChart";
910
import BarChart from "./examples/BarChart";
@@ -28,6 +29,16 @@ const initOptions = computed(() => ({
2829
provide(INIT_OPTIONS_KEY, initOptions);
2930
3031
const codeOpen = ref(location.hash === "#codegen");
32+
33+
if (codeOpen.value) {
34+
va.track("codegen", { from: "link" });
35+
}
36+
37+
function openCodegen() {
38+
codeOpen.value = true;
39+
va.track("codegen", { from: "click" });
40+
}
41+
3142
watch(codeOpen, open => {
3243
if (open) {
3344
location.hash = "#codegen";
@@ -89,7 +100,7 @@ watch(codeOpen, open => {
89100
</aside>
90101

91102
<aside class="codegen">
92-
<button @click="codeOpen = true">
103+
<button @click="openCodegen">
93104
✨ <code>import</code> Codegen <span class="badge">beta</span>
94105
</button>
95106
</aside>

0 commit comments

Comments
 (0)