Skip to content

Commit 98307b6

Browse files
committed
feat: send app version alongside all events
1 parent 0cb329f commit 98307b6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/components/Posthog.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
import { ReactElement, useEffect, useState } from "react";
2-
import { PostHogProvider } from "posthog-js/react"
2+
import { PostHogProvider, usePostHog } from "posthog-js/react"
33
import { invoke } from "@tauri-apps/api/core";
4+
import { app } from "@tauri-apps/api";
5+
46

57
const posthogKey = import.meta.env.PUBLIC_POSTHOG_KEY;
68
const posthogHost = import.meta.env.PUBLIC_POSTHOG_HOST;
79

810
export default function PosthogProvider({ children }: { children: ReactElement }) {
911

1012
const [isOkSharingUsageData, setIsOkSharingUsageData] = useState(true);
13+
const posthog = usePostHog();
14+
15+
useEffect(() => {
16+
app.getVersion().then(version => {
17+
posthog.register({
18+
'App Version': version
19+
})
20+
})
21+
}, [])
1122

1223
useEffect(() => {
1324
invoke('is_ok_sharing_usage_data').then((res) => {

0 commit comments

Comments
 (0)