feat: log user router preference as a user property (#6761)

* feat: log router preference in user properties

* fix: update analytics events
This commit is contained in:
eddie 2023-06-14 16:03:23 -07:00 committed by GitHub
parent d149512d93
commit e69a7c2712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

@ -157,7 +157,7 @@
"@sentry/types": "^7.45.0",
"@types/react-window-infinite-loader": "^1.0.6",
"@uniswap/analytics": "^1.3.1",
"@uniswap/analytics-events": "^2.10.0",
"@uniswap/analytics-events": "^2.13.0",
"@uniswap/conedison": "^1.7.1",
"@uniswap/governance": "^1.0.2",
"@uniswap/liquidity-staker": "^1.0.2",

@ -9,6 +9,7 @@ import { useBag } from 'nft/hooks/useBag'
import { lazy, Suspense, useEffect, useMemo, useState } from 'react'
import { Navigate, Route, Routes, useLocation, useSearchParams } from 'react-router-dom'
import { shouldDisableNFTRoutesAtom } from 'state/application/atoms'
import { useRouterPreference } from 'state/user/hooks'
import { StatsigProvider, StatsigUser } from 'statsig-react'
import styled from 'styled-components/macro'
import { SpinnerSVG } from 'theme/components'
@ -113,6 +114,7 @@ export default function App() {
const { pathname } = useLocation()
const currentPage = getCurrentPageFromLocation(pathname)
const isDarkMode = useIsDarkMode()
const [routerPreference] = useRouterPreference()
const [scrolledState, setScrolledState] = useState(false)
useAnalyticsReporter()
@ -160,6 +162,10 @@ export default function App() {
user.set(CustomUserProperties.DARK_MODE, isDarkMode)
}, [isDarkMode])
useEffect(() => {
user.set(CustomUserProperties.ROUTER_PREFERENCE, routerPreference)
}, [routerPreference])
useEffect(() => {
const scrollListener = () => {
setScrolledState(window.scrollY > 0)

@ -5536,10 +5536,10 @@
"@typescript-eslint/types" "5.59.1"
eslint-visitor-keys "^3.3.0"
"@uniswap/analytics-events@^2.10.0":
version "2.10.0"
resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.10.0.tgz#08c80d4c17212c112a7c182fa84a201b4199a241"
integrity sha512-Lkz2JqzixPDSGp71SczXMf9UQDo9QX2wEqfma09YoDHm8HCw/baqLQiK1KGdUQULZxbj64W4SH3nFlxq/Jb/OQ==
"@uniswap/analytics-events@^2.13.0":
version "2.13.0"
resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.13.0.tgz#9356efe311031ac751da563e7b8eeebcbe477574"
integrity sha512-rjlnxzKaswhQtP9w7rWJ79sqrLY1EigkCyc91yHNpbldTmF+a8Xxoec63Y6CsOqtsICX/CardR5dcXBSbFLL2A==
"@uniswap/analytics@^1.3.1":
version "1.3.1"