Commit bb1db904 authored by Adrian Kant's avatar Adrian Kant Committed by GitHub

refactor: using more specific analytics names (#5505)

* using new events library

* use not found page name constant

* use 2.0

* fix

* latest package including commonJS

* update to latest version
parent 20dbb2a9
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, SharedEventName } from '@uniswap/analytics-events'
import { Link } from 'react-router-dom'
import { useIsDarkMode } from 'state/user/hooks'
import styled from 'styled-components/macro'
......@@ -123,7 +123,11 @@ const LogoSectionContent = () => {
<SocialLink href="https://github.com/Uniswap" target="_blank" rel="noopener noreferrer">
<DiscordIcon size={32} />
</SocialLink>
<TraceEvent events={[BrowserEvent.onClick]} name={EventName.ELEMENT_CLICKED} element={ElementName.TWITTER_LINK}>
<TraceEvent
events={[BrowserEvent.onClick]}
name={SharedEventName.ELEMENT_CLICKED}
element={InterfaceElementName.TWITTER_LINK}
>
<SocialLink href="https://twitter.com/uniswap" target="_blank" rel="noopener noreferrer">
<TwitterIcon size={32} />
</SocialLink>
......
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, SharedEventName } from '@uniswap/analytics-events'
import { Link } from 'react-router-dom'
import { useIsDarkMode } from 'state/user/hooks'
import styled, { DefaultTheme } from 'styled-components/macro'
......@@ -123,7 +123,7 @@ const Card = ({
}) => {
const isDarkMode = useIsDarkMode()
return (
<TraceEvent events={[BrowserEvent.onClick]} name={EventName.ELEMENT_CLICKED} element={elementName}>
<TraceEvent events={[BrowserEvent.onClick]} name={SharedEventName.ELEMENT_CLICKED} element={elementName}>
<StyledCard
type={type}
as={external ? 'a' : Link}
......
import { ElementName } from '@uniswap/analytics-events'
import { InterfaceElementName } from '@uniswap/analytics-events'
import { DollarSign, Terminal } from 'react-feather'
import styled from 'styled-components/macro'
import { lightTheme } from 'theme/colors'
......@@ -18,7 +18,7 @@ export const MAIN_CARDS = [
cta: 'Trade Tokens',
darkBackgroundImgSrc: swapCardImgSrc,
lightBackgroundImgSrc: swapCardImgSrc,
elementName: ElementName.ABOUT_PAGE_SWAP_CARD,
elementName: InterfaceElementName.ABOUT_PAGE_SWAP_CARD,
},
{
to: '/nfts',
......@@ -27,7 +27,7 @@ export const MAIN_CARDS = [
cta: 'Explore NFTs',
darkBackgroundImgSrc: nftCardImgSrc,
lightBackgroundImgSrc: nftCardImgSrc,
elementName: ElementName.ABOUT_PAGE_NFTS_CARD,
elementName: InterfaceElementName.ABOUT_PAGE_NFTS_CARD,
},
]
......@@ -47,7 +47,7 @@ export const MORE_CARDS = [
lightIcon: <DollarSign color={lightTheme.textTertiary} size={48} />,
darkIcon: <StyledCardLogo src={darkDollarImgSrc} alt="Earn" />,
cta: 'Buy now',
elementName: ElementName.ABOUT_PAGE_BUY_CRYPTO_CARD,
elementName: InterfaceElementName.ABOUT_PAGE_BUY_CRYPTO_CARD,
},
{
to: '/pool',
......@@ -56,7 +56,7 @@ export const MORE_CARDS = [
lightIcon: <StyledCardLogo src={lightArrowImgSrc} alt="Analytics" />,
darkIcon: <StyledCardLogo src={darkArrowImgSrc} alt="Analytics" />,
cta: 'Provide liquidity',
elementName: ElementName.ABOUT_PAGE_EARN_CARD,
elementName: InterfaceElementName.ABOUT_PAGE_EARN_CARD,
},
{
to: 'https://docs.uniswap.org',
......@@ -66,6 +66,6 @@ export const MORE_CARDS = [
lightIcon: <Terminal color={lightTheme.textTertiary} size={48} />,
darkIcon: <StyledCardLogo src={darkTerminalImgSrc} alt="Developers" />,
cta: 'Developer docs',
elementName: ElementName.ABOUT_PAGE_DEV_DOCS_CARD,
elementName: InterfaceElementName.ABOUT_PAGE_DEV_DOCS_CARD,
},
]
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk'
import { useWeb3React } from '@web3-react/core'
......@@ -332,8 +332,8 @@ export default function SwapCurrencyInputPanel({
{showMaxButton && selectedCurrencyBalance ? (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.SWAP_MAX_TOKEN_AMOUNT_SELECTED}
element={ElementName.MAX_TOKEN_AMOUNT_BUTTON}
name={SwapEventName.SWAP_MAX_TOKEN_AMOUNT_SELECTED}
element={InterfaceElementName.MAX_TOKEN_AMOUNT_BUTTON}
>
<StyledBalanceMax onClick={onMax}>
<Trans>Max</Trans>
......
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk'
import { useWeb3React } from '@web3-react/core'
......@@ -315,8 +315,8 @@ export default function CurrencyInputPanel({
{showMaxButton && selectedCurrencyBalance ? (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.SWAP_MAX_TOKEN_AMOUNT_SELECTED}
element={ElementName.MAX_TOKEN_AMOUNT_BUTTON}
name={SwapEventName.SWAP_MAX_TOKEN_AMOUNT_SELECTED}
element={InterfaceElementName.MAX_TOKEN_AMOUNT_BUTTON}
>
<StyledBalanceMax onClick={onMax}>
<Trans>MAX</Trans>
......
// eslint-disable-next-line no-restricted-imports
import { t, Trans } from '@lingui/macro'
import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName, SectionName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName, InterfaceSectionName } from '@uniswap/analytics-events'
import clsx from 'clsx'
import useDebounce from 'hooks/useDebounce'
import { useIsNftPage } from 'hooks/useIsNftPage'
......@@ -109,7 +109,7 @@ export const SearchBar = () => {
const isMobileOrTablet = isMobile || isTablet
const trace = useTrace({ section: SectionName.NAVBAR_SEARCH })
const trace = useTrace({ section: InterfaceSectionName.NAVBAR_SEARCH })
const navbarSearchEventProperties = {
navbar_search_input_text: debouncedSearchValue,
......@@ -146,7 +146,7 @@ export const SearchBar = () => {
}, [handleKeyPress, inputRef])
return (
<Trace section={SectionName.NAVBAR_SEARCH}>
<Trace section={InterfaceSectionName.NAVBAR_SEARCH}>
<Box
position={{ sm: 'fixed', md: 'absolute', xl: 'relative' }}
width={{ sm: isOpen ? 'viewWidth' : 'auto', md: 'auto' }}
......@@ -178,8 +178,8 @@ export const SearchBar = () => {
</Box>
<TraceEvent
events={[BrowserEvent.onFocus]}
name={EventName.NAVBAR_SEARCH_SELECTED}
element={ElementName.NAVBAR_SEARCH_INPUT}
name={InterfaceEventName.NAVBAR_SEARCH_SELECTED}
element={InterfaceElementName.NAVBAR_SEARCH_INPUT}
properties={{ ...trace }}
>
<Trans
......@@ -192,7 +192,9 @@ export const SearchBar = () => {
!isOpen && toggleOpen()
setSearchValue(event.target.value)
}}
onBlur={() => sendAnalyticsEvent(EventName.NAVBAR_SEARCH_EXITED, navbarSearchEventProperties)}
onBlur={() =>
sendAnalyticsEvent(InterfaceEventName.NAVBAR_SEARCH_EXITED, navbarSearchEventProperties)
}
className={`${styles.searchBarInput} ${styles.searchContentLeftAlign}`}
value={searchValue}
ref={inputRef}
......
import { Trans } from '@lingui/macro'
import { useTrace } from '@uniswap/analytics'
import { NavBarSearchTypes, SectionName } from '@uniswap/analytics-events'
import { InterfaceSectionName, NavBarSearchTypes } from '@uniswap/analytics-events'
import { useIsNftPage } from 'hooks/useIsNftPage'
import { Box } from 'nft/components/Box'
import { Column, Row } from 'nft/components/Flex'
......@@ -202,7 +202,7 @@ export const SearchBarDropdown = ({
(isNFTPage && (hasVerifiedCollection || !hasVerifiedToken)) ||
(!isNFTPage && !hasVerifiedToken && hasVerifiedCollection)
const trace = JSON.stringify(useTrace({ section: SectionName.NAVBAR_SEARCH }))
const trace = JSON.stringify(useTrace({ section: InterfaceSectionName.NAVBAR_SEARCH }))
useEffect(() => {
const eventProperties = { total_suggestions: totalSuggestions, query_text: queryText, ...JSON.parse(trace) }
......
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { InterfaceEventName } from '@uniswap/analytics-events'
import { formatUSDPrice } from '@uniswap/conedison/format'
import { useWeb3React } from '@web3-react/core'
import clsx from 'clsx'
......@@ -71,7 +71,7 @@ export const CollectionRow = ({
const handleClick = useCallback(() => {
addToSearchHistory(collection)
toggleOpen()
sendAnalyticsEvent(EventName.NAVBAR_RESULT_SELECTED, { ...eventProperties })
sendAnalyticsEvent(InterfaceEventName.NAVBAR_RESULT_SELECTED, { ...eventProperties })
}, [addToSearchHistory, collection, toggleOpen, eventProperties])
useEffect(() => {
......@@ -157,7 +157,7 @@ export const TokenRow = ({ token, isHovered, setHoveredIndex, toggleOpen, index,
const handleClick = useCallback(() => {
addToSearchHistory(token)
toggleOpen()
sendAnalyticsEvent(EventName.NAVBAR_RESULT_SELECTED, { ...eventProperties })
sendAnalyticsEvent(InterfaceEventName.NAVBAR_RESULT_SELECTED, { ...eventProperties })
}, [addToSearchHistory, toggleOpen, token, eventProperties])
const [bridgedAddress, bridgedChain, L2Icon] = useBridgedAddress(token)
......
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
import { Currency } from '@uniswap/sdk-core'
import { AutoColumn } from 'components/Column'
import CurrencyLogo from 'components/Logo/CurrencyLogo'
......@@ -70,9 +70,9 @@ export default function CommonBases({
return (
<TraceEvent
events={[BrowserEvent.onClick, BrowserEvent.onKeyPress]}
name={EventName.TOKEN_SELECTED}
name={InterfaceEventName.TOKEN_SELECTED}
properties={formatAnalyticsEventProperties(currency, searchQuery, isAddressSearch)}
element={ElementName.COMMON_BASES_CURRENCY_BUTTON}
element={InterfaceElementName.COMMON_BASES_CURRENCY_BUTTON}
key={currencyId(currency)}
>
<BaseWrapper
......
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import TokenSafetyIcon from 'components/TokenSafety/TokenSafetyIcon'
......@@ -131,9 +131,9 @@ export function CurrencyRow({
return (
<TraceEvent
events={[BrowserEvent.onClick, BrowserEvent.onKeyPress]}
name={EventName.TOKEN_SELECTED}
name={InterfaceEventName.TOKEN_SELECTED}
properties={{ is_imported_by_user: customAdded, ...eventProperties }}
element={ElementName.TOKEN_SELECTOR_ROW}
element={InterfaceElementName.TOKEN_SELECTOR_ROW}
>
<MenuItem
tabIndex={0}
......
// eslint-disable-next-line no-restricted-imports
import { t, Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { EventName, ModalName } from '@uniswap/analytics-events'
import { InterfaceEventName, InterfaceModalName } from '@uniswap/analytics-events'
import { Currency, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics'
......@@ -181,7 +181,11 @@ export function CurrencySearch({
return (
<ContentWrapper>
<Trace name={EventName.TOKEN_SELECTOR_OPENED} modal={ModalName.TOKEN_SELECTOR} shouldLogImpression>
<Trace
name={InterfaceEventName.TOKEN_SELECTOR_OPENED}
modal={InterfaceModalName.TOKEN_SELECTOR}
shouldLogImpression
>
<PaddedColumn gap="16px">
<RowBetween>
<Text fontWeight={500} fontSize={16}>
......
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { Currency } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import CurrencyLogo from 'components/Logo/CurrencyLogo'
......@@ -176,7 +176,7 @@ export default function TokenDetails({
}
return (
<Trace
page={PageName.TOKEN_DETAILS_PAGE}
page={InterfacePageName.TOKEN_DETAILS_PAGE}
properties={{ tokenAddress: address, tokenName: token?.name }}
shouldLogImpression
>
......
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
import searchIcon from 'assets/svg/search.svg'
import xIcon from 'assets/svg/x.svg'
import useDebounce from 'hooks/useDebounce'
......@@ -80,8 +80,8 @@ export default function SearchBar() {
render={({ translation }) => (
<TraceEvent
events={[BrowserEvent.onFocus]}
name={EventName.EXPLORE_SEARCH_SELECTED}
element={ElementName.EXPLORE_SEARCH_INPUT}
name={InterfaceEventName.EXPLORE_SEARCH_SELECTED}
element={InterfaceElementName.EXPLORE_SEARCH_INPUT}
>
<SearchInput
type="search"
......
import { Trans } from '@lingui/macro'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { InterfaceEventName } from '@uniswap/analytics-events'
import { formatNumber, formatUSDPrice, NumberType } from '@uniswap/conedison/format'
import { ParentSize } from '@visx/responsive'
import SparklineChart from 'components/Charts/SparklineChart'
......@@ -472,7 +472,9 @@ export const LoadedRow = forwardRef((props: LoadedRowProps, ref: ForwardedRef<HT
<div ref={ref} data-testid={`token-table-row-${tokenName}`}>
<StyledLink
to={getTokenDetailsURL(token.address ?? '', token.chain)}
onClick={() => sendAnalyticsEvent(EventName.EXPLORE_TOKEN_ROW_CLICKED, exploreTokenSelectedEventProperties)}
onClick={() =>
sendAnalyticsEvent(InterfaceEventName.EXPLORE_TOKEN_ROW_CLICKED, exploreTokenSelectedEventProperties)
}
>
<TokenRow
header={false}
......
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
import React from 'react'
import { Check } from 'react-feather'
import styled from 'styled-components/macro'
......@@ -116,9 +116,9 @@ export default function Option({
const content = (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.WALLET_SELECTED}
name={InterfaceEventName.WALLET_SELECTED}
properties={{ wallet_type: header }}
element={ElementName.WALLET_TYPE_OPTION}
element={InterfaceElementName.WALLET_TYPE_OPTION}
>
<OptionCardClickable
id={id}
......
import { Trans } from '@lingui/macro'
import { sendAnalyticsEvent, user } from '@uniswap/analytics'
import { CustomUserProperties, EventName, WalletConnectionResult } from '@uniswap/analytics-events'
import { CustomUserProperties, InterfaceEventName, WalletConnectionResult } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { Connector } from '@web3-react/types'
import { sendEvent } from 'components/analytics'
......@@ -125,7 +125,7 @@ const sendAnalyticsEventAndUserInfo = (
chainId: number | undefined,
isReconnect: boolean
) => {
sendAnalyticsEvent(EventName.WALLET_CONNECT_TXN_COMPLETED, {
sendAnalyticsEvent(InterfaceEventName.WALLET_CONNECT_TXN_COMPLETED, {
result: WalletConnectionResult.SUCCEEDED,
wallet_address: account,
wallet_type: walletType,
......@@ -236,7 +236,7 @@ export default function WalletModal({
console.debug(`web3-react connection error: ${error}`)
dispatch(updateConnectionError({ connectionType, error: error.message }))
sendAnalyticsEvent(EventName.WALLET_CONNECT_TXN_COMPLETED, {
sendAnalyticsEvent(InterfaceEventName.WALLET_CONNECT_TXN_COMPLETED, {
result: WalletConnectionResult.FAILED,
wallet_type: getConnectionName(connectionType, getIsMetaMask()),
})
......
import { Trans } from '@lingui/macro'
import { sendAnalyticsEvent, TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { FiatOnrampAnnouncement } from 'components/FiatOnrampAnnouncement'
import { IconWrapper } from 'components/Identicon/StatusIcon'
......@@ -284,9 +284,9 @@ function Web3StatusInner() {
return (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.CONNECT_WALLET_BUTTON_CLICKED}
name={InterfaceEventName.CONNECT_WALLET_BUTTON_CLICKED}
properties={{ received_swap_quote: validSwapQuote }}
element={ElementName.CONNECT_WALLET_BUTTON}
element={InterfaceElementName.CONNECT_WALLET_BUTTON}
>
<Web3StatusConnectWrapper faded={!account}>
<StyledConnectButton data-testid="navbar-connect-wallet" onClick={toggleWalletModal}>
......
import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics'
import { EventName, SectionName, SwapPriceUpdateUserResponse } from '@uniswap/analytics-events'
import {
InterfaceEventName,
InterfaceSectionName,
SwapEventName,
SwapPriceUpdateUserResponse,
} from '@uniswap/analytics-events'
import { Trade } from '@uniswap/router-sdk'
import { Currency, TradeType } from '@uniswap/sdk-core'
import {
......@@ -58,7 +63,7 @@ export default function Widget({ token, onTokenChange, onReviewSwapClick }: Widg
[connector]
)
const trace = useTrace({ section: SectionName.WIDGET })
const trace = useTrace({ section: InterfaceSectionName.WIDGET })
const [initialQuoteDate, setInitialQuoteDate] = useState<Date>()
const onInitialSwapQuote = useCallback(
(trade: Trade<Currency, Currency, TradeType>) => {
......@@ -72,7 +77,7 @@ export default function Widget({ token, onTokenChange, onReviewSwapClick }: Widg
),
...trace,
}
sendAnalyticsEvent(EventName.SWAP_QUOTE_RECEIVED, eventProperties)
sendAnalyticsEvent(SwapEventName.SWAP_QUOTE_RECEIVED, eventProperties)
},
[trace]
)
......@@ -85,10 +90,10 @@ export default function Widget({ token, onTokenChange, onReviewSwapClick }: Widg
token_address: getTokenAddress(input),
...trace,
}
sendAnalyticsEvent(EventName.APPROVE_TOKEN_TXN_SUBMITTED, eventProperties)
sendAnalyticsEvent(InterfaceEventName.APPROVE_TOKEN_TXN_SUBMITTED, eventProperties)
}, [inputs.value.INPUT, trace])
const onExpandSwapDetails = useCallback(() => {
sendAnalyticsEvent(EventName.SWAP_DETAILS_EXPANDED, { ...trace })
sendAnalyticsEvent(SwapEventName.SWAP_DETAILS_EXPANDED, { ...trace })
}, [trace])
const onSwapPriceUpdateAck = useCallback(
(stale: Trade<Currency, Currency, TradeType>, update: Trade<Currency, Currency, TradeType>) => {
......@@ -100,7 +105,7 @@ export default function Widget({ token, onTokenChange, onReviewSwapClick }: Widg
price_update_basis_points: getPriceUpdateBasisPoints(stale.executionPrice, update.executionPrice),
...trace,
}
sendAnalyticsEvent(EventName.SWAP_PRICE_UPDATE_ACKNOWLEDGED, eventProperties)
sendAnalyticsEvent(SwapEventName.SWAP_PRICE_UPDATE_ACKNOWLEDGED, eventProperties)
},
[trace]
)
......@@ -127,7 +132,7 @@ export default function Widget({ token, onTokenChange, onReviewSwapClick }: Widg
swap_quote_block_number: undefined,
...trace,
}
sendAnalyticsEvent(EventName.SWAP_SUBMITTED_BUTTON_CLICKED, eventProperties)
sendAnalyticsEvent(SwapEventName.SWAP_SUBMITTED_BUTTON_CLICKED, eventProperties)
},
[initialQuoteDate, trace]
)
......
import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics'
import { EventName, SectionName } from '@uniswap/analytics-events'
import { InterfaceSectionName, SwapEventName } from '@uniswap/analytics-events'
import { Currency, Field, SwapController, SwapEventHandlers, TradeType } from '@uniswap/widgets'
import CurrencySearchModal from 'components/SearchModal/CurrencySearchModal'
import { useCallback, useEffect, useMemo, useState } from 'react'
......@@ -26,7 +26,7 @@ export function useSyncWidgetInputs({
token?: Currency
onTokenChange?: (token: Currency) => void
}) {
const trace = useTrace({ section: SectionName.WIDGET })
const trace = useTrace({ section: InterfaceSectionName.WIDGET })
const [type, setType] = useState<SwapValue['type']>(TradeType.EXACT_INPUT)
const [amount, setAmount] = useState<SwapValue['amount']>(EMPTY_AMOUNT)
......@@ -45,7 +45,7 @@ export function useSyncWidgetInputs({
const onAmountChange = useCallback(
(field: Field, amount: string, origin?: 'max') => {
if (origin === 'max') {
sendAnalyticsEvent(EventName.SWAP_MAX_TOKEN_AMOUNT_SELECTED, { ...trace })
sendAnalyticsEvent(SwapEventName.SWAP_MAX_TOKEN_AMOUNT_SELECTED, { ...trace })
}
setType(field === Field.INPUT ? TradeType.EXACT_INPUT : TradeType.EXACT_OUTPUT)
setAmount(amount)
......@@ -54,7 +54,7 @@ export function useSyncWidgetInputs({
)
const onSwitchTokens = useCallback(() => {
sendAnalyticsEvent(EventName.SWAP_TOKENS_REVERSED, { ...trace })
sendAnalyticsEvent(SwapEventName.SWAP_TOKENS_REVERSED, { ...trace })
setType((type) => invertTradeType(type))
setTokens((tokens) => ({
[Field.INPUT]: tokens[Field.OUTPUT],
......
import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics'
import { EventName, SectionName } from '@uniswap/analytics-events'
import { InterfaceEventName, InterfaceSectionName, SwapEventName } from '@uniswap/analytics-events'
import {
TradeType,
Transaction,
......@@ -22,7 +22,7 @@ import { currencyId } from 'utils/currencyId'
/** Integrates the Widget's transactions, showing the widget's transactions in the app. */
export function useSyncWidgetTransactions() {
const trace = useTrace({ section: SectionName.WIDGET })
const trace = useTrace({ section: InterfaceSectionName.WIDGET })
const { chainId } = useWeb3React()
const addTransaction = useTransactionAdder()
......@@ -49,7 +49,7 @@ export function useSyncWidgetTransactions() {
type: type === WidgetTransactionType.WRAP ? WrapType.WRAP : WrapType.UNWRAP,
...trace,
}
sendAnalyticsEvent(EventName.WRAP_TOKEN_TXN_SUBMITTED, eventProperties)
sendAnalyticsEvent(InterfaceEventName.WRAP_TOKEN_TXN_SUBMITTED, eventProperties)
const { amount } = transaction.info
addTransaction(response, {
type: AppTransactionType.WRAP,
......@@ -67,7 +67,7 @@ export function useSyncWidgetTransactions() {
}),
...trace,
}
sendAnalyticsEvent(EventName.SWAP_SIGNED, eventProperties)
sendAnalyticsEvent(SwapEventName.SWAP_SIGNED, eventProperties)
const baseTxInfo = {
type: AppTransactionType.SWAP,
tradeType,
......
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { ModalName } from '@uniswap/analytics-events'
import { InterfaceModalName } from '@uniswap/analytics-events'
import { Trade } from '@uniswap/router-sdk'
import { Currency, CurrencyAmount, Percent, Token, TradeType } from '@uniswap/sdk-core'
import { ReactNode, useCallback, useMemo, useState } from 'react'
......@@ -122,7 +122,7 @@ export default function ConfirmSwapModal({
)
return (
<Trace modal={ModalName.CONFIRM_SWAP}>
<Trace modal={InterfaceModalName.CONFIRM_SWAP}>
<TransactionConfirmationModal
isOpen={isOpen}
onDismiss={onModalDismiss}
......
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events'
import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import AnimatedDropdown from 'components/AnimatedDropdown'
......@@ -123,8 +123,8 @@ export default function SwapDetailsDropdown({ trade, syncing, loading, allowedSl
<AutoColumn gap="sm" style={{ width: '100%', marginBottom: '-8px' }}>
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.SWAP_DETAILS_EXPANDED}
element={ElementName.SWAP_DETAILS_DROPDOWN}
name={SwapEventName.SWAP_DETAILS_EXPANDED}
element={InterfaceElementName.SWAP_DETAILS_DROPDOWN}
shouldLogImpression={!showDetails}
>
<StyledHeaderRow onClick={() => setShowDetails(!showDetails)} disabled={!trade} open={showDetails}>
......
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Percent, Token, TradeType } from '@uniswap/sdk-core'
import useTransactionDeadline from 'hooks/useTransactionDeadline'
import {
......@@ -131,8 +131,8 @@ export default function SwapModalFooter({
<AutoRow>
<TraceEvent
events={[BrowserEvent.onClick]}
element={ElementName.CONFIRM_SWAP_BUTTON}
name={EventName.SWAP_SUBMITTED_BUTTON_CLICKED}
element={InterfaceElementName.CONFIRM_SWAP_BUTTON}
name={SwapEventName.SWAP_SUBMITTED_BUTTON_CLICKED}
properties={formatAnalyticsEventProperties({
trade,
hash,
......@@ -150,7 +150,7 @@ export default function SwapModalFooter({
onClick={onConfirm}
disabled={disabledConfirm}
style={{ margin: '10px 0 0 0' }}
id={ElementName.CONFIRM_SWAP_BUTTON}
id={InterfaceElementName.CONFIRM_SWAP_BUTTON}
>
<Text fontSize={20} fontWeight={500}>
<Trans>Confirm Swap</Trans>
......
import { Trans } from '@lingui/macro'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName, SwapPriceUpdateUserResponse } from '@uniswap/analytics-events'
import { SwapEventName, SwapPriceUpdateUserResponse } from '@uniswap/analytics-events'
import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
import { getPriceUpdateBasisPoints } from 'lib/utils/analytics'
import { useEffect, useState } from 'react'
......@@ -91,7 +91,7 @@ export default function SwapModalHeader({
useEffect(() => {
if (shouldLogModalCloseEvent && showAcceptChanges)
sendAnalyticsEvent(
EventName.SWAP_PRICE_UPDATE_ACKNOWLEDGED,
SwapEventName.SWAP_PRICE_UPDATE_ACKNOWLEDGED,
formatAnalyticsEventProperties(trade, priceUpdate, SwapPriceUpdateUserResponse.REJECTED)
)
setShouldLogModalCloseEvent(false)
......
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, SwapEventName } from '@uniswap/analytics-events'
import { Protocol } from '@uniswap/router-sdk'
import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk'
......@@ -66,8 +66,8 @@ export default memo(function SwapRoute({ trade, syncing, fixedOpen = false, ...r
<Wrapper {...rest} darkMode={darkMode} fixedOpen={fixedOpen}>
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.SWAP_AUTOROUTER_VISUALIZATION_EXPANDED}
element={ElementName.AUTOROUTER_VISUALIZATION_ROW}
name={SwapEventName.SWAP_AUTOROUTER_VISUALIZATION_EXPANDED}
element={InterfaceElementName.AUTOROUTER_VISUALIZATION_ROW}
shouldLogImpression={!open}
>
<RowBetween onClick={() => setOpen(!open)}>
......
import { Trans } from '@lingui/macro'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { InterfaceEventName } from '@uniswap/analytics-events'
import { Currency } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import useNativeCurrency from 'lib/hooks/useNativeCurrency'
......@@ -104,7 +104,7 @@ export default function useWrapCallback(
network.chainId !== chainId ||
wethContract.address !== WRAPPED_NATIVE_CURRENCY[network.chainId]?.address
) {
sendAnalyticsEvent(EventName.WRAP_TOKEN_TXN_INVALIDATED, {
sendAnalyticsEvent(InterfaceEventName.WRAP_TOKEN_TXN_INVALIDATED, {
...eventProperties,
contract_address: wethContract.address,
contract_chain_id: network.chainId,
......@@ -122,7 +122,10 @@ Please file a bug detailing how this happened - https://github.com/Uniswap/inter
currencyAmountRaw: inputAmount?.quotient.toString(),
chainId,
})
sendAnalyticsEvent(EventName.WRAP_TOKEN_TXN_SUBMITTED, { ...eventProperties, type: WrapType.WRAP })
sendAnalyticsEvent(InterfaceEventName.WRAP_TOKEN_TXN_SUBMITTED, {
...eventProperties,
type: WrapType.WRAP,
})
} catch (error) {
console.error('Could not deposit', error)
}
......@@ -148,7 +151,10 @@ Please file a bug detailing how this happened - https://github.com/Uniswap/inter
currencyAmountRaw: inputAmount?.quotient.toString(),
chainId,
})
sendAnalyticsEvent(EventName.WRAP_TOKEN_TXN_SUBMITTED, { ...eventProperties, type: WrapType.UNWRAP })
sendAnalyticsEvent(InterfaceEventName.WRAP_TOKEN_TXN_SUBMITTED, {
...eventProperties,
type: WrapType.UNWRAP,
})
} catch (error) {
console.error('Could not withdraw', error)
}
......
......@@ -3,7 +3,7 @@ import type { JsonRpcProvider, TransactionResponse } from '@ethersproject/provid
// eslint-disable-next-line no-restricted-imports
import { t, Trans } from '@lingui/macro'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { SwapEventName } from '@uniswap/analytics-events'
import { Trade } from '@uniswap/router-sdk'
import { Currency, TradeType } from '@uniswap/sdk-core'
import { formatSwapSignedAnalyticsEventProperties } from 'lib/utils/analytics'
......@@ -120,11 +120,11 @@ export default function useSendSwapTransaction(
})
.then((response) => {
sendAnalyticsEvent(
EventName.SWAP_SIGNED,
SwapEventName.SWAP_SIGNED,
formatSwapSignedAnalyticsEventProperties({ trade, txHash: response.hash })
)
if (calldata !== response.data) {
sendAnalyticsEvent(EventName.SWAP_MODIFIED_IN_WALLET, { txHash: response.hash })
sendAnalyticsEvent(SwapEventName.SWAP_MODIFIED_IN_WALLET, { txHash: response.hash })
throw new InvalidSwapError(
t`Your swap was modified through your wallet. If this was a mistake, please cancel immediately or risk losing your funds.`
)
......
import { MaxUint256 } from '@ethersproject/constants'
import type { TransactionResponse } from '@ethersproject/providers'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { InterfaceEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { useTokenContract } from 'hooks/useContract'
......@@ -97,7 +97,7 @@ export function useApproval(
token_symbol: token?.symbol,
token_address: getTokenAddress(token),
}
sendAnalyticsEvent(EventName.APPROVE_TOKEN_TXN_SUBMITTED, eventProperties)
sendAnalyticsEvent(InterfaceEventName.APPROVE_TOKEN_TXN_SUBMITTED, eventProperties)
return {
response,
tokenAddress: token.address,
......
import { BigNumber } from '@ethersproject/bignumber'
import { formatEther } from '@ethersproject/units'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { NFTEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { useIsNftDetailsPage, useIsNftPage, useIsNftProfilePage } from 'hooks/useIsNftPage'
import { BagFooter } from 'nft/components/bag/BagFooter'
......@@ -351,7 +351,7 @@ const Bag = () => {
onClick={() => {
isMobile && toggleBag()
setProfilePageState(ProfilePageStateType.LISTING)
sendAnalyticsEvent(EventName.NFT_PROFILE_PAGE_START_SELL, {
sendAnalyticsEvent(NFTEventName.NFT_PROFILE_PAGE_START_SELL, {
list_quantity: sellAssets.length,
collection_addresses: sellAssets.map((asset) => asset.asset_contract.address),
token_ids: sellAssets.map((asset) => asset.tokenId),
......
import { sendAnalyticsEvent, Trace } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { NFTEventName } from '@uniswap/analytics-events'
import { BagRow, PriceChangeBagRow, UnavailableAssetsHeaderRow } from 'nft/components/bag/BagRow'
import { Column } from 'nft/components/Flex'
import { useBag, useIsMobile } from 'nft/hooks'
......@@ -46,7 +46,7 @@ export const BagContent = () => {
const hasAssets = itemsInBag.length > 0
if (hasAssetsInReview)
sendAnalyticsEvent(EventName.NFT_BUY_BAG_CHANGED, {
sendAnalyticsEvent(NFTEventName.NFT_BUY_BAG_CHANGED, {
usd_value: fetchedPriceData,
bag_quantity: itemsInBag,
...formatAssetEventProperties(priceChangedAssets),
......@@ -67,7 +67,7 @@ export const BagContent = () => {
<Column display={priceChangedAssets.length > 0 || unavailableAssets.length > 0 ? 'flex' : 'none'}>
{unavailableAssets.length > 0 && (
<Trace
name={EventName.NFT_BUY_BAG_CHANGED}
name={NFTEventName.NFT_BUY_BAG_CHANGED}
properties={{
usd_value: fetchedPriceData,
bag_quantity: itemsInBag.length,
......
......@@ -2,7 +2,7 @@ import { BigNumber } from '@ethersproject/bignumber'
import { parseEther } from '@ethersproject/units'
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import Loader from 'components/Loader'
import { SupportedChainId } from 'constants/chains'
......@@ -172,8 +172,8 @@ export const BagFooter = ({
</Column>
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.NFT_BUY_BAG_PAY}
element={ElementName.NFT_BUY_BAG_PAY_BUTTON}
name={NFTEventName.NFT_BUY_BAG_PAY}
element={InterfaceElementName.NFT_BUY_BAG_PAY_BUTTON}
properties={{ ...eventProperties }}
shouldLogImpression={connected && !disabled}
>
......
import { addressesByNetwork, SupportedChainId } from '@looksrare/sdk'
import { sendAnalyticsEvent, Trace, useTrace } from '@uniswap/analytics'
import { EventName, ModalName } from '@uniswap/analytics-events'
import { InterfaceModalName, NFTEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { Box } from 'nft/components/Box'
import { Column, Row } from 'nft/components/Flex'
......@@ -37,7 +37,7 @@ const ListingModal = () => {
const toggleCart = useBag((state) => state.toggleBag)
const looksRareNonceRef = useRef(looksRareNonce)
const isMobile = useIsMobile()
const trace = useTrace({ modal: ModalName.NFT_LISTING })
const trace = useTrace({ modal: InterfaceModalName.NFT_LISTING })
useEffect(() => {
useNFTList.subscribe((state) => (looksRareNonceRef.current = state.looksRareNonce))
......@@ -107,7 +107,7 @@ const ListingModal = () => {
// handles the modal wide listing state based on conglomeration of the wallet, collection, and listing states
const startListingFlow = async () => {
if (!signer) return
sendAnalyticsEvent(EventName.NFT_SELL_START_LISTING, { ...startListingEventProperties })
sendAnalyticsEvent(NFTEventName.NFT_SELL_START_LISTING, { ...startListingEventProperties })
setListingStatus(ListingStatus.SIGNING)
const addresses = addressesByNetwork[SupportedChainId.MAINNET]
const signerAddress = await signer.getAddress()
......@@ -168,7 +168,7 @@ const ListingModal = () => {
} else if (!paused) {
setListingStatus(ListingStatus.FAILED)
}
sendAnalyticsEvent(EventName.NFT_LISTING_SIGNED, {
sendAnalyticsEvent(NFTEventName.NFT_LISTING_COMPLETED, {
signatures_approved: listings.filter((asset) => asset.status === ListingStatus.APPROVED),
list_quantity: listings.length,
usd_value: ethPriceInUSD * totalEthListingValue,
......@@ -207,7 +207,7 @@ const ListingModal = () => {
const showSuccessScreen = useMemo(() => listingStatus === ListingStatus.APPROVED, [listingStatus])
return (
<Trace modal={ModalName.NFT_LISTING}>
<Trace modal={InterfaceModalName.NFT_LISTING}>
<Column paddingTop="20" paddingBottom="20" paddingLeft="12" paddingRight="12">
<Row className={headlineSmall} marginBottom="10">
{isMobile && !showSuccessScreen && (
......@@ -234,7 +234,7 @@ const ListingModal = () => {
<Column overflowX="hidden" overflowY="auto" style={{ maxHeight: '60vh' }}>
{showSuccessScreen ? (
<Trace
name={EventName.NFT_LISTING_COMPLETED}
name={NFTEventName.NFT_LISTING_COMPLETED}
properties={{ list_quantity: listings.length, usd_value: ethPriceInUSD * totalEthListingValue, ...trace }}
shouldLogImpression
>
......
import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics'
import { EventName, PageName } from '@uniswap/analytics-events'
import { InterfacePageName, NFTEventName } from '@uniswap/analytics-events'
import { ChainId } from '@uniswap/smart-order-router'
import { MouseoverTooltip } from 'components/Tooltip'
import { Box } from 'nft/components/Box'
......@@ -101,7 +101,7 @@ export const BuyCell = ({
return itemsInBag.some((item) => asset.tokenId === item.asset.tokenId && asset.address === item.asset.address)
}, [asset, itemsInBag])
const trace = useTrace({ page: PageName.NFT_COLLECTION_PAGE })
const trace = useTrace({ page: InterfacePageName.NFT_COLLECTION_PAGE })
const eventProperties = {
collection_address: asset.address,
......@@ -120,7 +120,7 @@ export const BuyCell = ({
e.preventDefault()
isSelected ? removeAsset([asset]) : selectAsset([asset])
!isSelected && !cartExpanded && !isMobile && toggleCart()
!isSelected && sendAnalyticsEvent(EventName.NFT_BUY_ADDED, { eventProperties })
!isSelected && sendAnalyticsEvent(NFTEventName.NFT_BUY_ADDED, { eventProperties })
}}
disabled={event.orderStatus !== OrderStatus.VALID}
>
......
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events'
import { Box } from 'nft/components/Box'
import { Row } from 'nft/components/Flex'
import { useIsCollectionLoading } from 'nft/hooks'
......@@ -41,8 +41,8 @@ export const ActivitySwitcher = ({
</Box>
<TraceEvent
events={[BrowserEvent.onClick]}
element={ElementName.NFT_ACTIVITY_TAB}
name={EventName.NFT_ACTIVITY_SELECTED}
element={InterfaceElementName.NFT_ACTIVITY_TAB}
name={NFTEventName.NFT_ACTIVITY_SELECTED}
>
<Box
as="button"
......
import { BigNumber } from '@ethersproject/bignumber'
import { Trans } from '@lingui/macro'
import { sendAnalyticsEvent, useTrace } from '@uniswap/analytics'
import { EventName, PageName } from '@uniswap/analytics-events'
import { InterfacePageName, NFTEventName } from '@uniswap/analytics-events'
import { MouseoverTooltip } from 'components/Tooltip'
import Tooltip from 'components/Tooltip'
import { NftStandard } from 'graphql/data/__generated__/types-and-hooks'
......@@ -60,7 +60,7 @@ export const CollectionAsset = ({
const itemsInBag = useBag((state) => state.itemsInBag)
const bagExpanded = useBag((state) => state.bagExpanded)
const setBagExpanded = useBag((state) => state.setBagExpanded)
const trace = useTrace({ page: PageName.NFT_COLLECTION_PAGE })
const trace = useTrace({ page: InterfacePageName.NFT_COLLECTION_PAGE })
const { isSelected } = useMemo(() => {
const matchingItems = itemsInBag.filter(
......@@ -94,7 +94,7 @@ export const CollectionAsset = ({
if (!bagExpanded && !isMobile && !bagManuallyClosed) {
setBagExpanded({ bagExpanded: true })
}
sendAnalyticsEvent(EventName.NFT_BUY_ADDED, {
sendAnalyticsEvent(NFTEventName.NFT_BUY_ADDED, {
collection_address: asset.address,
token_id: asset.tokenId,
token_type: asset.tokenType,
......
import { BigNumber } from '@ethersproject/bignumber'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import clsx from 'clsx'
import { OpacityHoverState } from 'components/Common'
......@@ -512,8 +512,8 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
<ActionsSubContainer>
<TraceEvent
events={[BrowserEvent.onClick]}
element={ElementName.NFT_FILTER_BUTTON}
name={EventName.NFT_FILTER_OPENED}
element={InterfaceElementName.NFT_FILTER_BUTTON}
name={NFTEventName.NFT_FILTER_OPENED}
shouldLogImpression={!isFiltersExpanded}
properties={{ collection_address: contractAddress, chain_id: chainId }}
>
......
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName, FilterTypes } from '@uniswap/analytics-events'
import { NFTEventName, NFTFilterTypes } from '@uniswap/analytics-events'
import clsx from 'clsx'
import { Box } from 'nft/components/Box'
import * as styles from 'nft/components/collection/Filters.css'
......@@ -98,7 +98,7 @@ const MarketplaceItem = ({
removeMarket(value)
setCheckboxSelected(false)
}
sendAnalyticsEvent(EventName.NFT_FILTER_SELECTED, { filter_type: FilterTypes.MARKETPLACE })
sendAnalyticsEvent(NFTEventName.NFT_FILTER_SELECTED, { filter_type: NFTFilterTypes.MARKETPLACE })
}
const checkbox = (
......
import 'rc-slider/assets/index.css'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName, FilterTypes } from '@uniswap/analytics-events'
import { NFTEventName, NFTFilterTypes } from '@uniswap/analytics-events'
import { Box } from 'nft/components/Box'
import { Row } from 'nft/components/Flex'
import { NumericInput } from 'nft/components/layout/Input'
......@@ -55,7 +55,7 @@ export const PriceRange = () => {
e.currentTarget.placeholder = placeholderText
setPlaceholderText('')
if (minPrice || maxPrice)
sendAnalyticsEvent(EventName.NFT_FILTER_SELECTED, { filter_type: FilterTypes.PRICE_RANGE })
sendAnalyticsEvent(NFTEventName.NFT_FILTER_SELECTED, { filter_type: NFTFilterTypes.PRICE_RANGE })
}
const updateMinPriceRange = (v: FormEvent<HTMLInputElement>) => {
......
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName, FilterTypes } from '@uniswap/analytics-events'
import { NFTEventName, NFTFilterTypes } from '@uniswap/analytics-events'
import useDebounce from 'hooks/useDebounce'
import { Box } from 'nft/components/Box'
import { Column, Row } from 'nft/components/Flex'
......@@ -61,7 +61,7 @@ const TraitItem = ({
removeTrait(trait)
setCheckboxSelected(false)
}
sendAnalyticsEvent(EventName.NFT_FILTER_SELECTED, { filter_type: FilterTypes.TRAIT })
sendAnalyticsEvent(NFTEventName.NFT_FILTER_SELECTED, { filter_type: NFTFilterTypes.TRAIT })
}
const showFullTraitName = shouldShow && trait_type === trait.trait_type && trait_value === trait.trait_value
......
import { formatEther } from '@ethersproject/units'
import { Trans } from '@lingui/macro'
import { Trace, useTrace } from '@uniswap/analytics'
import { EventName, ModalName } from '@uniswap/analytics-events'
import { InterfaceModalName, NFTEventName } from '@uniswap/analytics-events'
import clsx from 'clsx'
import { OpacityHoverState } from 'components/Common'
import { Box } from 'nft/components/Box'
......@@ -58,7 +58,7 @@ const TxCompleteModal = () => {
const isMobile = useIsMobile()
const txHashUrl = getExplorerLink(1, txHash, ExplorerDataType.TRANSACTION)
const shouldShowModal = (txState === TxStateType.Success || txState === TxStateType.Failed) && txState
const trace = useTrace({ modal: ModalName.NFT_TX_COMPLETE })
const trace = useTrace({ modal: InterfaceModalName.NFT_TX_COMPLETE })
const {
nftsPurchased,
nftsNotPurchased,
......@@ -110,7 +110,7 @@ const TxCompleteModal = () => {
{/* Successfully purchased NFTs */}
{showPurchasedModal && (
<Trace
name={EventName.NFT_BUY_BAG_SUCCEEDED}
name={NFTEventName.NFT_BUY_BAG_SUCCEEDED}
properties={{
buy_quantity: nftsPurchased.length,
usd_value: parseFloat(formatEther(totalPurchaseValue)) * ethPrice,
......@@ -189,7 +189,7 @@ const TxCompleteModal = () => {
/* Showing both purchases & refunds */
(showPurchasedModal ? (
<Trace
name={EventName.NFT_BUY_BAG_REFUNDED}
name={NFTEventName.NFT_BUY_BAG_REFUNDED}
properties={{
buy_quantity: nftsPurchased.length,
fail_quantity: nftsNotPurchased.length,
......@@ -266,7 +266,7 @@ const TxCompleteModal = () => {
) : (
// Only showing when all assets are unavailable
<Trace
name={EventName.NFT_BUY_BAG_REFUNDED}
name={NFTEventName.NFT_BUY_BAG_REFUNDED}
properties={{
buy_quantity: 0,
fail_quantity: nftsNotPurchased.length,
......
import { useTrace } from '@uniswap/analytics'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { NFTEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { OpacityHoverState } from 'components/Common'
import { useNftBalance } from 'graphql/data/nft/NftBalance'
......@@ -230,7 +230,7 @@ const OwnerContainer = ({ asset }: { asset: WalletAsset }) => {
resetSellAssets()
navigate('/nfts/profile')
selectSellAsset(asset)
sendAnalyticsEvent(EventName.NFT_SELL_ITEM_ADDED, {
sendAnalyticsEvent(NFTEventName.NFT_SELL_ITEM_ADDED, {
collection_address: asset.asset_contract.address,
token_id: asset.tokenId,
...trace,
......
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, NFTEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { LoadingBubble } from 'components/Tokens/loading'
import { useWindowSize } from 'hooks/useWindowSize'
......@@ -189,9 +189,9 @@ export function Table<D extends Record<string, unknown>>({
return (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.NFT_TRENDING_ROW_SELECTED}
name={NFTEventName.NFT_TRENDING_ROW_SELECTED}
properties={{ collection_address: row.original.collection.address, chain_id: chainId }}
element={ElementName.NFT_TRENDING_ROW}
element={InterfaceElementName.NFT_TRENDING_ROW}
key={i}
>
<StyledRow
......
import { Trans } from '@lingui/macro'
import { useTrace } from '@uniswap/analytics'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { NFTEventName } from '@uniswap/analytics-events'
import { MouseoverTooltip } from 'components/Tooltip'
import Tooltip from 'components/Tooltip'
import { NftStandard } from 'graphql/data/__generated__/types-and-hooks'
......@@ -77,7 +77,7 @@ export const ViewMyNftsAsset = ({
removeSellAsset(asset)
} else {
selectSellAsset(asset)
sendAnalyticsEvent(EventName.NFT_SELL_ITEM_ADDED, {
sendAnalyticsEvent(NFTEventName.NFT_SELL_ITEM_ADDED, {
collection_address: asset.asset_contract.address,
token_id: asset.tokenId,
...trace,
......
......@@ -4,7 +4,7 @@ import { hexStripZeros } from '@ethersproject/bytes'
import { ContractReceipt } from '@ethersproject/contracts'
import type { JsonRpcSigner } from '@ethersproject/providers'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { NFTEventName } from '@uniswap/analytics-events'
import create from 'zustand'
import { devtools } from 'zustand/middleware'
......@@ -50,7 +50,7 @@ export const useSendTransaction = create<TxState>()(
const res = await signer.sendTransaction(tx)
set({ state: TxStateType.Confirming })
set({ txHash: res.hash })
sendAnalyticsEvent(EventName.NFT_BUY_BAG_SIGNED, { transaction_hash: res.hash })
sendAnalyticsEvent(NFTEventName.NFT_BUY_BAG_SIGNED, { transaction_hash: res.hash })
const txReceipt = await res.wait()
......
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { useNftAssetDetails } from 'graphql/data/nft/Details'
import { AssetDetails } from 'nft/components/details/AssetDetails'
import { AssetDetailsLoading } from 'nft/components/details/AssetDetailsLoading'
......@@ -45,7 +45,7 @@ const AssetPage = () => {
return (
<>
<Trace
page={PageName.NFT_DETAILS_PAGE}
page={InterfacePageName.NFT_DETAILS_PAGE}
properties={{ collection_address: contractAddress, token_id: tokenId }}
shouldLogImpression
>
......
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import Column from 'components/Column'
import { OpacityHoverState } from 'components/Common'
......@@ -179,7 +179,7 @@ const Collection = () => {
return (
<>
<Trace
page={PageName.NFT_COLLECTION_PAGE}
page={InterfacePageName.NFT_COLLECTION_PAGE}
properties={{ collection_address: contractAddress, chain_id: chainId, is_activity_view: isActivityToggled }}
shouldLogImpression
>
......
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import Banner from 'nft/components/explore/Banner'
import TrendingCollections from 'nft/components/explore/TrendingCollections'
import { useBag } from 'nft/hooks'
......@@ -30,7 +30,7 @@ const NftExplore = () => {
return (
<>
<Trace page={PageName.NFT_EXPLORE_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.NFT_EXPLORE_PAGE} shouldLogImpression>
<ExploreContainer>
<Banner />
<TrendingCollections />
......
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { Box } from 'nft/components/Box'
import { Center, Column } from 'nft/components/Flex'
......@@ -44,7 +44,7 @@ const ProfileContent = () => {
const cartExpanded = useBag((state) => state.bagExpanded)
return (
<Trace page={PageName.NFT_PROFILE_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.NFT_PROFILE_PAGE} shouldLogImpression>
<Box className={styles.profileWrapper}>
{/* <Head> TODO: figure out metadata tagging
<title>Genie | Sell</title>
......
......@@ -2,7 +2,7 @@ import { BigNumber } from '@ethersproject/bignumber'
import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
import { FeeAmount, NonfungiblePositionManager } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
......@@ -442,9 +442,9 @@ export default function AddLiquidity() {
) : !account ? (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.CONNECT_WALLET_BUTTON_CLICKED}
name={InterfaceEventName.CONNECT_WALLET_BUTTON_CLICKED}
properties={{ received_swap_quote: false }}
element={ElementName.CONNECT_WALLET_BUTTON}
element={InterfaceElementName.CONNECT_WALLET_BUTTON}
>
<ButtonLight onClick={toggleWalletModal} $borderRadius="12px" padding="12px">
<Trans>Connect Wallet</Trans>
......
......@@ -2,7 +2,7 @@ import { BigNumber } from '@ethersproject/bignumber'
import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics'
......@@ -437,9 +437,9 @@ export default function AddLiquidity() {
) : !account ? (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.CONNECT_WALLET_BUTTON_CLICKED}
name={InterfaceEventName.CONNECT_WALLET_BUTTON_CLICKED}
properties={{ received_swap_quote: false }}
element={ElementName.CONNECT_WALLET_BUTTON}
element={InterfaceElementName.CONNECT_WALLET_BUTTON}
>
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
......
import { initializeAnalytics, OriginApplication, sendAnalyticsEvent, Trace, user } from '@uniswap/analytics'
import { CustomUserProperties, EventName, getBrowser, PageName } from '@uniswap/analytics-events'
import { CustomUserProperties, getBrowser, InterfacePageName, SharedEventName } from '@uniswap/analytics-events'
import Loader from 'components/Loader'
import { MenuDropdown } from 'components/NavBar/MenuDropdown'
import TopLevelModals from 'components/TopLevelModals'
......@@ -54,7 +54,7 @@ const ANALYTICS_PROXY_URL = process.env.REACT_APP_AMPLITUDE_PROXY_URL
const COMMIT_HASH = process.env.REACT_APP_GIT_COMMIT_HASH
initializeAnalytics(ANALYTICS_DUMMY_KEY, OriginApplication.INTERFACE, {
proxyUrl: ANALYTICS_PROXY_URL,
defaultEventName: EventName.PAGE_VIEWED,
defaultEventName: SharedEventName.PAGE_VIEWED,
commitHash: COMMIT_HASH,
isProductionEnv: isProductionEnv(),
})
......@@ -99,24 +99,24 @@ const HeaderWrapper = styled.div<{ transparent?: boolean }>`
z-index: ${Z_INDEX.dropdown};
`
function getCurrentPageFromLocation(locationPathname: string): PageName | undefined {
function getCurrentPageFromLocation(locationPathname: string): InterfacePageName | undefined {
switch (true) {
case locationPathname.startsWith('/swap'):
return PageName.SWAP_PAGE
return InterfacePageName.SWAP_PAGE
case locationPathname.startsWith('/vote'):
return PageName.VOTE_PAGE
return InterfacePageName.VOTE_PAGE
case locationPathname.startsWith('/pool'):
return PageName.POOL_PAGE
return InterfacePageName.POOL_PAGE
case locationPathname.startsWith('/tokens'):
return PageName.TOKENS_PAGE
return InterfacePageName.TOKENS_PAGE
case locationPathname.startsWith('/nfts/profile'):
return PageName.NFT_PROFILE_PAGE
return InterfacePageName.NFT_PROFILE_PAGE
case locationPathname.startsWith('/nfts/asset'):
return PageName.NFT_DETAILS_PAGE
return InterfacePageName.NFT_DETAILS_PAGE
case locationPathname.startsWith('/nfts/collection'):
return PageName.NFT_COLLECTION_PAGE
return InterfacePageName.NFT_COLLECTION_PAGE
case locationPathname.startsWith('/nfts'):
return PageName.NFT_EXPLORE_PAGE
return InterfacePageName.NFT_EXPLORE_PAGE
default:
return undefined
}
......@@ -153,15 +153,17 @@ export default function App() {
}, [pathname])
useEffect(() => {
sendAnalyticsEvent(EventName.APP_LOADED)
sendAnalyticsEvent(SharedEventName.APP_LOADED)
user.set(CustomUserProperties.USER_AGENT, navigator.userAgent)
user.set(CustomUserProperties.BROWSER, getBrowser())
user.set(CustomUserProperties.SCREEN_RESOLUTION_HEIGHT, window.screen.height)
user.set(CustomUserProperties.SCREEN_RESOLUTION_WIDTH, window.screen.width)
getCLS(({ delta }: Metric) => sendAnalyticsEvent(EventName.WEB_VITALS, { cumulative_layout_shift: delta }))
getFCP(({ delta }: Metric) => sendAnalyticsEvent(EventName.WEB_VITALS, { first_contentful_paint_ms: delta }))
getFID(({ delta }: Metric) => sendAnalyticsEvent(EventName.WEB_VITALS, { first_input_delay_ms: delta }))
getLCP(({ delta }: Metric) => sendAnalyticsEvent(EventName.WEB_VITALS, { largest_contentful_paint_ms: delta }))
getCLS(({ delta }: Metric) => sendAnalyticsEvent(SharedEventName.WEB_VITALS, { cumulative_layout_shift: delta }))
getFCP(({ delta }: Metric) => sendAnalyticsEvent(SharedEventName.WEB_VITALS, { first_contentful_paint_ms: delta }))
getFID(({ delta }: Metric) => sendAnalyticsEvent(SharedEventName.WEB_VITALS, { first_input_delay_ms: delta }))
getLCP(({ delta }: Metric) =>
sendAnalyticsEvent(SharedEventName.WEB_VITALS, { largest_contentful_paint_ms: delta })
)
}, [])
useEffect(() => {
......
......@@ -2,7 +2,7 @@ import { defaultAbiCoder } from '@ethersproject/abi'
import { getAddress, isAddress } from '@ethersproject/address'
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { ButtonError } from 'components/Button'
......@@ -239,7 +239,7 @@ ${bodyValue}
}
return (
<Trace page={PageName.VOTE_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.VOTE_PAGE} shouldLogImpression>
<PageWrapper>
<AppBody $maxWidth="800px">
<CreateProposalTabs />
......
import { Trans } from '@lingui/macro'
import { Trace, TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName, PageName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfacePageName, SharedEventName } from '@uniswap/analytics-events'
import { AboutFooter } from 'components/About/AboutFooter'
import Card, { CardType } from 'components/About/Card'
import { MAIN_CARDS, MORE_CARDS } from 'components/About/constants'
......@@ -297,14 +297,14 @@ export default function Landing() {
}, [navigate, selectedWallet, queryParams.intro])
return (
<Trace page={PageName.LANDING_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.LANDING_PAGE} shouldLogImpression>
{showContent && (
<PageContainer isDarkMode={isDarkMode} data-testid="landing-page">
<LandingSwapContainer>
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.ELEMENT_CLICKED}
element={ElementName.LANDING_PAGE_SWAP_ELEMENT}
name={SharedEventName.ELEMENT_CLICKED}
element={InterfaceElementName.LANDING_PAGE_SWAP_ELEMENT}
>
<Link to="/swap">
<LandingSwap />
......@@ -323,8 +323,8 @@ export default function Landing() {
<ActionsContainer>
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.ELEMENT_CLICKED}
element={ElementName.CONTINUE_BUTTON}
name={SharedEventName.ELEMENT_CLICKED}
element={InterfaceElementName.CONTINUE_BUTTON}
>
<ButtonCTA as={Link} to="/swap">
<ButtonCTAText>Get started</ButtonCTAText>
......
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { InterfacePageName } from '@uniswap/analytics-events'
import { SmallButtonPrimary } from 'components/Button'
import { useIsMobile } from 'nft/hooks'
import { Link } from 'react-router-dom'
......@@ -46,7 +47,7 @@ export default function NotFound() {
return (
<PageWrapper>
<Trace page="404-page" shouldLogImpression>
<Trace page={InterfacePageName.NOT_FOUND} shouldLogImpression>
<Header>
<Container>
<Title>404</Title>
......
......@@ -2,7 +2,7 @@ import { BigNumber } from '@ethersproject/bignumber'
import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core'
import { NonfungiblePositionManager, Pool, Position } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
......@@ -582,7 +582,7 @@ export function PositionPage() {
<div />
</LoadingRows>
) : (
<Trace page={PageName.POOL_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
<>
<PageWrapper>
<TransactionConfirmationModal
......
import { Trans } from '@lingui/macro'
import { Trace, TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName, PageName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName, InterfacePageName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { ButtonGray, ButtonPrimary, ButtonText } from 'components/Button'
import { AutoColumn } from 'components/Column'
......@@ -262,7 +262,7 @@ export default function Pool() {
]
return (
<Trace page={PageName.POOL_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
<PageWrapper>
<AutoColumn gap="lg" justify="center">
<AutoColumn gap="lg" style={{ width: '100%' }}>
......@@ -319,9 +319,9 @@ export default function Pool() {
{showConnectAWallet && (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.CONNECT_WALLET_BUTTON_CLICKED}
name={InterfaceEventName.CONNECT_WALLET_BUTTON_CLICKED}
properties={{ received_swap_quote: false }}
element={ElementName.CONNECT_WALLET_BUTTON}
element={InterfaceElementName.CONNECT_WALLET_BUTTON}
>
<ButtonPrimary
style={{ marginTop: '2em', marginBottom: '2em', padding: '8px 16px' }}
......
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { Pair } from '@uniswap/v2-sdk'
import { useWeb3React } from '@web3-react/core'
import { UNSUPPORTED_V2POOL_CHAIN_IDS } from 'constants/chains'
......@@ -140,7 +140,7 @@ export default function Pool() {
})
return (
<Trace page={PageName.POOL_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
<>
<PageWrapper>
<VoteCard>
......
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi'
......@@ -97,7 +97,7 @@ export default function PoolFinder() {
)
return (
<Trace page={PageName.POOL_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.POOL_PAGE} shouldLogImpression>
<>
<AppBody>
<FindPoolTabs origin={query.get('origin') ?? '/pool/v2'} />
......
......@@ -3,7 +3,7 @@ import { Contract } from '@ethersproject/contracts'
import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro'
import { TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName } from '@uniswap/analytics-events'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
import { Currency, Percent } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics'
......@@ -626,9 +626,9 @@ export default function RemoveLiquidity() {
{!account ? (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.CONNECT_WALLET_BUTTON_CLICKED}
name={InterfaceEventName.CONNECT_WALLET_BUTTON_CLICKED}
properties={{ received_swap_quote: false }}
element={ElementName.CONNECT_WALLET_BUTTON}
element={InterfaceElementName.CONNECT_WALLET_BUTTON}
>
<ButtonLight onClick={toggleWalletModal}>
<Trans>Connect Wallet</Trans>
......
import { Trans } from '@lingui/macro'
import { sendAnalyticsEvent, Trace, TraceEvent } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName, PageName, SectionName } from '@uniswap/analytics-events'
import {
BrowserEvent,
InterfaceElementName,
InterfaceEventName,
InterfacePageName,
InterfaceSectionName,
SwapEventName,
} from '@uniswap/analytics-events'
import { Trade } from '@uniswap/router-sdk'
import { Currency, CurrencyAmount, Percent, Token, TradeType } from '@uniswap/sdk-core'
import { UNIVERSAL_ROUTER_ADDRESS } from '@uniswap/universal-router-sdk'
......@@ -308,7 +315,7 @@ export default function Swap({ className }: { className?: string }) {
try {
const approval = await permit.callback?.()
if (approval) {
sendAnalyticsEvent(EventName.APPROVE_TOKEN_TXN_SUBMITTED, {
sendAnalyticsEvent(InterfaceEventName.APPROVE_TOKEN_TXN_SUBMITTED, {
chain_id: chainId,
token_symbol: maximumAmountIn?.currency.symbol,
token_address: maximumAmountIn?.currency.address,
......@@ -510,7 +517,7 @@ export default function Swap({ className }: { className?: string }) {
setSwapQuoteReceivedDate(now)
// Log swap quote.
sendAnalyticsEvent(
EventName.SWAP_QUOTE_RECEIVED,
SwapEventName.SWAP_QUOTE_RECEIVED,
formatSwapQuoteReceivedEventProperties(trade, trade.gasUseEstimateUSD ?? undefined, fetchingSwapQuoteStartTime)
)
// Latest swap quote has just been logged, so we don't need to log the current trade anymore
......@@ -541,7 +548,7 @@ export default function Swap({ className }: { className?: string }) {
)
return (
<Trace page={PageName.SWAP_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.SWAP_PAGE} shouldLogImpression>
<>
<TokenSafetyModal
isOpen={importTokensNotInDefault.length > 0 && !dismissTokenWarning}
......@@ -573,7 +580,7 @@ export default function Swap({ className }: { className?: string }) {
<div style={{ display: 'relative' }}>
<SwapSection>
<Trace section={SectionName.CURRENCY_INPUT_PANEL}>
<Trace section={InterfaceSectionName.CURRENCY_INPUT_PANEL}>
<SwapCurrencyInputPanel
label={
independentField === Field.OUTPUT && !showWrap ? (
......@@ -591,7 +598,7 @@ export default function Swap({ className }: { className?: string }) {
onCurrencySelect={handleInputSelect}
otherCurrency={currencies[Field.OUTPUT]}
showCommonBases={true}
id={SectionName.CURRENCY_INPUT_PANEL}
id={InterfaceSectionName.CURRENCY_INPUT_PANEL}
loading={independentField === Field.OUTPUT && routeIsSyncing}
/>
</Trace>
......@@ -599,8 +606,8 @@ export default function Swap({ className }: { className?: string }) {
<ArrowWrapper clickable={isSupportedChain(chainId)}>
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.SWAP_TOKENS_REVERSED}
element={ElementName.SWAP_TOKENS_REVERSE_ARROW_BUTTON}
name={SwapEventName.SWAP_TOKENS_REVERSED}
element={InterfaceElementName.SWAP_TOKENS_REVERSE_ARROW_BUTTON}
>
<ArrowContainer
onClick={() => {
......@@ -622,7 +629,7 @@ export default function Swap({ className }: { className?: string }) {
<AutoColumn gap="md">
<div>
<OutputSwapSection showDetailsDropdown={showDetailsDropdown}>
<Trace section={SectionName.CURRENCY_OUTPUT_PANEL}>
<Trace section={InterfaceSectionName.CURRENCY_OUTPUT_PANEL}>
<SwapCurrencyInputPanel
value={formattedAmounts[Field.OUTPUT]}
onUserInput={handleTypeOutput}
......@@ -637,7 +644,7 @@ export default function Swap({ className }: { className?: string }) {
onCurrencySelect={handleOutputSelect}
otherCurrency={currencies[Field.INPUT]}
showCommonBases={true}
id={SectionName.CURRENCY_OUTPUT_PANEL}
id={InterfaceSectionName.CURRENCY_OUTPUT_PANEL}
loading={independentField === Field.INPUT && routeIsSyncing}
/>
</Trace>
......@@ -678,9 +685,9 @@ export default function Swap({ className }: { className?: string }) {
) : !account ? (
<TraceEvent
events={[BrowserEvent.onClick]}
name={EventName.CONNECT_WALLET_BUTTON_CLICKED}
name={InterfaceEventName.CONNECT_WALLET_BUTTON_CLICKED}
properties={{ received_swap_quote: getIsValidSwapQuote(trade, tradeState, swapInputError) }}
element={ElementName.CONNECT_WALLET_BUTTON}
element={InterfaceElementName.CONNECT_WALLET_BUTTON}
>
<ButtonLight onClick={toggleWalletModal} fontWeight={600}>
<Trans>Connect Wallet</Trans>
......
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core'
import { MAX_WIDTH_MEDIA_BREAKPOINT, MEDIUM_MEDIA_BREAKPOINT } from 'components/Tokens/constants'
import { filterStringAtom } from 'components/Tokens/state'
......@@ -94,7 +94,7 @@ const Tokens = () => {
})
return (
<Trace page={PageName.TOKENS_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.TOKENS_PAGE} shouldLogImpression>
<ExploreContainer>
<TitleContainer>
<MouseoverTooltip
......
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { ButtonPrimary } from 'components/Button'
......@@ -145,7 +145,7 @@ export default function Landing() {
)
return (
<>
<Trace page={PageName.VOTE_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.VOTE_PAGE} shouldLogImpression>
<PageWrapper gap="lg" justify="center">
<DelegateModal
isOpen={showDelegateModal}
......
import { BigNumber } from '@ethersproject/bignumber'
import { Trans } from '@lingui/macro'
import { Trace } from '@uniswap/analytics'
import { PageName } from '@uniswap/analytics-events'
import { InterfacePageName } from '@uniswap/analytics-events'
import { CurrencyAmount, Fraction, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import ExecuteModal from 'components/vote/ExecuteModal'
......@@ -271,7 +271,7 @@ export default function VotePage() {
}
return (
<Trace page={PageName.VOTE_PAGE} shouldLogImpression>
<Trace page={InterfacePageName.VOTE_PAGE} shouldLogImpression>
<>
<PageWrapper gap="lg" justify="center">
<VoteModal
......
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { EventName } from '@uniswap/analytics-events'
import { SwapEventName } from '@uniswap/analytics-events'
import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { DEFAULT_TXN_DISMISS_MS, L2_TXN_DISMISS_MS } from 'constants/misc'
......@@ -83,7 +83,7 @@ export default function Updater() {
if (tx.info.type === TransactionType.SWAP && trade) {
sendAnalyticsEvent(
EventName.SWAP_TRANSACTION_COMPLETED,
SwapEventName.SWAP_TRANSACTION_COMPLETED,
formatAnalyticsEventProperties({
trade,
hash,
......
......@@ -4921,10 +4921,10 @@
"@typescript-eslint/types" "5.47.0"
eslint-visitor-keys "^3.3.0"
"@uniswap/analytics-events@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-1.5.0.tgz#1f5a6e0fedb46e551745c2b4d2b791fe44964cfa"
integrity sha512-grrPk71hoBeXiBivlqgeh97lY7TmKEYhzzOLXdMXjXX/mcGOM9HLV0XR1olr/WPwuhBFx9GefaiB3GJU9+/sOQ==
"@uniswap/analytics-events@2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.1.0.tgz#0a112f642d0121fdf69b5dc9a17639f06aa63085"
integrity sha512-HkWyri7PxnIS6B5sysym1LCMPnenkeAFyI41fYGDUNq3a5aEDuD77jyyFSwdW4yZfUOxq3zBUTmeQOIf/GT+tQ==
"@uniswap/analytics@1.2.0":
version "1.2.0"
......
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