Skip to content

Commit ad9cc20

Browse files
committed
wip(frontend): add desktop stats
1 parent 09696d6 commit ad9cc20

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.github/workflows/release-desktop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ jobs:
140140
VITE_NOTIFY_SERVICE_HOST: "https://notify.seed.hyper.media"
141141
VITE_DESKTOP_SENTRY_DSN: "${{ secrets.DESKTOP_SENTRY_DSN }}"
142142
VITE_SEED_HOST_URL: "https://host.seed.hyper.media"
143+
VITE_PLAUSIBLE_DOMAIN: "stats.desktop.seedhypermedia.com"
143144
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
144145
APPLE_ID: ${{ secrets.APPLE_ID }}
145146
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
@@ -182,6 +183,7 @@ jobs:
182183
VITE_NOTIFY_SERVICE_HOST: "https://notify.seed.hyper.media"
183184
VITE_DESKTOP_SENTRY_DSN: "${{ secrets.DESKTOP_SENTRY_DSN }}"
184185
VITE_SEED_HOST_URL: "https://host.seed.hyper.media"
186+
VITE_PLAUSIBLE_DOMAIN: "stats.desktop.seedhypermedia.com"
185187
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
186188

187189
- name: Upload Artifacts

frontend/apps/desktop/src/renderer.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ import {IS_PROD_DESKTOP} from '@shm/shared/constants'
3030

3131
import './root.tsx'
3232

33+
// Inject Plausible analytics script when VITE_PLAUSIBLE_DOMAIN is set (production CI builds only)
34+
// @ts-expect-error
35+
const plausibleDomain = import.meta.env.VITE_PLAUSIBLE_DOMAIN
36+
if (plausibleDomain) {
37+
const script = document.createElement('script')
38+
script.defer = true
39+
script.dataset.domain = plausibleDomain
40+
script.setAttribute('file-types', 'rpm,deb,dmg,exe')
41+
script.src =
42+
'https://plausible.io/js/script.file-downloads.hash.outbound-links.pageview-props.revenue.tagged-events.js'
43+
document.head.appendChild(script)
44+
}
45+
3346
if (IS_PROD_DESKTOP) {
3447
Sentry.init({
3548
// @ts-ignore

frontend/packages/ui/src/document-tools.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {DocumentPanelRoute, NavRoute, useRouteLink} from '@shm/shared'
2-
import {IS_DESKTOP} from '@shm/shared/constants'
32
import {HMExistingDraft, UnpackedHypermediaId} from '@shm/shared/hm-types'
43
import {useIsomorphicLayoutEffect} from '@shm/shared/utils/use-isomorphic-layout-effect'
54
import {MessageSquare, Newspaper, Users} from 'lucide-react'
@@ -274,9 +273,7 @@ function ToolLink({
274273
let btn = (
275274
<Button
276275
className={cn(
277-
`flex-1 rounded-full ${
278-
IS_DESKTOP ? '' : 'plausible-event-name=Open+Document+Comments'
279-
}`,
276+
'plausible-event-name=Open+Document+Comments flex-1 rounded-full',
280277
bg,
281278
)}
282279
asChild

0 commit comments

Comments
 (0)