Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
feat: :sparkles: customize theme and locale based on query params
akashrajpurohit_postmanec7bc92497eb
diff --git a/hooks/useLocale.js b/hooks/useLocale.jsindex fdce6d917..339ff4ba2 100644--- a/hooks/useLocale.js+++ b/hooks/useLocale.js@@ -48,5 +48,14 @@ export default function useLocale() {}}, [locale]);+ useEffect(() => {+ const url = new URL(window.location.href);+ const locale = url.searchParams.get('locale');++ if (locale) {+ saveLocale(locale);+ }+ }, []);+return { locale, saveLocale, messages, dir, dateLocale };}diff --git a/hooks/useTheme.js b/hooks/useTheme.jsindex cc02631ed..47ac31dd4 100644--- a/hooks/useTheme.js+++ b/hooks/useTheme.js@@ -23,5 +23,14 @@ export default function useTheme() {document.body.setAttribute('data-theme', theme);}, [theme]);+ useEffect(() => {+ const url = new URL(window.location.href);+ const theme = url.searchParams.get('theme');++ if (['light', 'dark'].includes(theme)) {+ saveTheme(theme);+ }+ }, []);+return [theme, saveTheme];}