Commit fdabb90f authored by Moody Salem's avatar Moody Salem

fix: fire a GA event when the locale is switched

parent 049054f5
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import React, { useMemo } from 'react' import React, { useMemo } from 'react'
import ReactGA from 'react-ga'
import { useLocation } from 'react-router' import { useLocation } from 'react-router'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { DEFAULT_LOCALE, LOCALE_LABEL, SupportedLocale } from '../../constants/locales' import { DEFAULT_LOCALE, LOCALE_LABEL, SupportedLocale } from '../../constants/locales'
...@@ -38,7 +39,21 @@ export function SwitchLocaleLink() { ...@@ -38,7 +39,21 @@ export function SwitchLocaleLink() {
return ( return (
<Container> <Container>
<Trans> <Trans>
Uniswap available in: {<StyledInternalLink to={target}>{LOCALE_LABEL[targetLocale]}</StyledInternalLink>} Uniswap available in:{' '}
{
<StyledInternalLink
onClick={() => {
ReactGA.event({
category: 'Localization',
action: 'Switch Locale',
label: `${activeLocale} -> ${targetLocale}`,
})
}}
to={target}
>
{LOCALE_LABEL[targetLocale]}
</StyledInternalLink>
}
</Trans> </Trans>
</Container> </Container>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment