Skip to content

Commit

Permalink
Track light mode/dark mode in Fathom
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 26, 2024
1 parent a57efdf commit 5dc1b6f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/src/js/MainMenuViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export class MainMenuViewModel {
clickAnalytics: true,
},
});
const anyWindow = (window as any);
if (typeof anyWindow.fathom !== 'undefined') {
anyWindow.fathom.trackEvent(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'darkMode' : 'lightMode');
}
}

toggleMainMenu(): void {
Expand Down

0 comments on commit 5dc1b6f

Please sign in to comment.