mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add basic event actions to analytics (#2375)
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
014097a97e
commit
abde1daba4
20 changed files with 183 additions and 61 deletions
|
@ -1,4 +1,5 @@
|
|||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
import { EVENT_CHANGE, trackEvent } from "./analytics";
|
||||
|
||||
import fallbackLanguageData from "./locales/en.json";
|
||||
import percentages from "./locales/percentages.json";
|
||||
|
@ -67,8 +68,8 @@ export const setLanguage = async (newLng: string | undefined) => {
|
|||
currentLanguageData = await import(
|
||||
/* webpackChunkName: "i18n-[request]" */ `./locales/${currentLanguage.lng}.json`
|
||||
);
|
||||
|
||||
languageDetector.cacheUserLanguage(currentLanguage.lng);
|
||||
trackEvent(EVENT_CHANGE, "language", currentLanguage.lng);
|
||||
};
|
||||
|
||||
export const setLanguageFirstTime = async () => {
|
||||
|
@ -84,6 +85,7 @@ export const setLanguageFirstTime = async () => {
|
|||
);
|
||||
|
||||
languageDetector.cacheUserLanguage(currentLanguage.lng);
|
||||
trackEvent(EVENT_CHANGE, "language on load", currentLanguage.lng);
|
||||
};
|
||||
|
||||
export const getLanguage = () => currentLanguage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue