From e3ca1c9e1e2b13eb1eaa6ccb7ca436b2fbd54bc8 Mon Sep 17 00:00:00 2001 From: shayan khaleghparast Date: Wed, 24 Jul 2024 12:25:18 +0800 Subject: [PATCH 1/2] fix: updated the way we fetch currentLang --- src/hooks/custom-hooks/useDerivAnalytics.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/hooks/custom-hooks/useDerivAnalytics.ts b/src/hooks/custom-hooks/useDerivAnalytics.ts index 7c485259..2ec6fdf1 100644 --- a/src/hooks/custom-hooks/useDerivAnalytics.ts +++ b/src/hooks/custom-hooks/useDerivAnalytics.ts @@ -3,9 +3,8 @@ import Cookies from 'js-cookie'; import { FIREBASE_INIT_DATA } from '@/constants'; import { Analytics } from '@deriv-com/analytics'; import { useWebsiteStatus } from '@deriv-com/api-hooks'; -import { useTranslations } from '@deriv-com/translations'; import { useDevice } from '@deriv-com/ui'; -import { WebSocketUtils } from '@deriv-com/utils'; +import { LocalStorageConstants, WebSocketUtils } from '@deriv-com/utils'; import { useActiveAccount } from '../api/account'; /** @@ -16,7 +15,7 @@ const useDerivAnalytics = () => { const { data: activeAccount } = useActiveAccount(); const { data: websiteStatus } = useWebsiteStatus(); const { isMobile } = useDevice(); - const { currentLang = 'EN' } = useTranslations(); + const currentLang = localStorage.getItem(LocalStorageConstants.i18nLanguage) || 'EN'; const initialise = async () => { try { @@ -60,7 +59,7 @@ const useDerivAnalytics = () => { device_language: navigator?.language || 'en-EN', device_type: isMobile ? 'mobile' : 'desktop', domain: window.location.hostname, - user_language: currentLang.toLowerCase(), + user_language: currentLang, utm_campaign: ppcCampaignCookies?.utm_campaign, utm_content: ppcCampaignCookies?.utm_content, utm_medium: ppcCampaignCookies?.utm_medium, From 58f3b47870a8ca9cf87f57f4f736fac350e7db80 Mon Sep 17 00:00:00 2001 From: shayan khaleghparast Date: Wed, 24 Jul 2024 12:33:27 +0800 Subject: [PATCH 2/2] chore: reverted changes --- src/hooks/custom-hooks/useDerivAnalytics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/custom-hooks/useDerivAnalytics.ts b/src/hooks/custom-hooks/useDerivAnalytics.ts index 2ec6fdf1..247028ba 100644 --- a/src/hooks/custom-hooks/useDerivAnalytics.ts +++ b/src/hooks/custom-hooks/useDerivAnalytics.ts @@ -59,7 +59,7 @@ const useDerivAnalytics = () => { device_language: navigator?.language || 'en-EN', device_type: isMobile ? 'mobile' : 'desktop', domain: window.location.hostname, - user_language: currentLang, + user_language: currentLang.toLowerCase(), utm_campaign: ppcCampaignCookies?.utm_campaign, utm_content: ppcCampaignCookies?.utm_content, utm_medium: ppcCampaignCookies?.utm_medium,