Commit a9b2179e authored by eddie's avatar eddie Committed by GitHub

feat: move ga events to amplitude (#7300)

* feat: move ga events to amplitude

* fix: add deets to add events
parent 0fffff66
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { FeePoolSelectAction, LiquidityEventName } from '@uniswap/analytics-events'
import { Currency } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import { FeeAmount } from '@uniswap/v3-sdk' import { FeeAmount } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendAnalyticsEvent, useTrace } from 'analytics'
import { ButtonGray } from 'components/Button' import { ButtonGray } from 'components/Button'
import Card from 'components/Card' import Card from 'components/Card'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
...@@ -60,6 +61,7 @@ export default function FeeSelector({ ...@@ -60,6 +61,7 @@ export default function FeeSelector({
currencyB?: Currency currencyB?: Currency
}) { }) {
const { chainId } = useWeb3React() const { chainId } = useWeb3React()
const trace = useTrace()
const { isLoading, isError, largestUsageFeeTier, distributions } = useFeeTierDistribution(currencyA, currencyB) const { isLoading, isError, largestUsageFeeTier, distributions } = useFeeTierDistribution(currencyA, currencyB)
...@@ -101,13 +103,13 @@ export default function FeeSelector({ ...@@ -101,13 +103,13 @@ export default function FeeSelector({
const handleFeePoolSelectWithEvent = useCallback( const handleFeePoolSelectWithEvent = useCallback(
(fee: FeeAmount) => { (fee: FeeAmount) => {
sendEvent({ sendAnalyticsEvent(LiquidityEventName.SELECT_LIQUIDITY_POOL_FEE_TIER, {
category: 'FeePoolSelect', action: FeePoolSelectAction.MANUAL,
action: 'Manual', ...trace,
}) })
handleFeePoolSelect(fee) handleFeePoolSelect(fee)
}, },
[handleFeePoolSelect] [handleFeePoolSelect, trace]
) )
useEffect(() => { useEffect(() => {
...@@ -122,14 +124,14 @@ export default function FeeSelector({ ...@@ -122,14 +124,14 @@ export default function FeeSelector({
setShowOptions(false) setShowOptions(false)
recommended.current = true recommended.current = true
sendEvent({ sendAnalyticsEvent(LiquidityEventName.SELECT_LIQUIDITY_POOL_FEE_TIER, {
category: 'FeePoolSelect', action: FeePoolSelectAction.RECOMMENDED,
action: ' Recommended', ...trace,
}) })
handleFeePoolSelect(largestUsageFeeTier) handleFeePoolSelect(largestUsageFeeTier)
} }
}, [feeAmount, isLoading, isError, largestUsageFeeTier, handleFeePoolSelect]) }, [feeAmount, isLoading, isError, largestUsageFeeTier, handleFeePoolSelect, trace])
useEffect(() => { useEffect(() => {
setShowOptions(isError) setShowOptions(isError)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { sendEvent } from 'components/analytics' import { SharedEventName } from '@uniswap/analytics-events'
import { sendAnalyticsEvent } from 'analytics'
import Card, { DarkGrayCard } from 'components/Card' import Card, { DarkGrayCard } from 'components/Card'
import Row, { AutoRow, RowBetween } from 'components/Row' import Row, { AutoRow, RowBetween } from 'components/Row'
import { useEffect, useRef } from 'react' import { useEffect, useRef } from 'react'
...@@ -87,7 +88,7 @@ export function PrivacyPolicyModal() { ...@@ -87,7 +88,7 @@ export function PrivacyPolicyModal() {
useEffect(() => { useEffect(() => {
if (!open) return if (!open) return
sendEvent({ sendAnalyticsEvent(SharedEventName.PAGE_VIEWED, {
category: 'Modal', category: 'Modal',
action: 'Show Legal', action: 'Show Legal',
}) })
......
import { InterfaceEventName } from '@uniswap/analytics-events'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { sendAnalyticsEvent } from 'analytics'
import { useEffect } from 'react' import { useEffect } from 'react'
import { UaEventOptions } from 'react-ga4/types/ga4' import { UaEventOptions } from 'react-ga4/types/ga4'
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
...@@ -18,15 +20,10 @@ export function sendEvent(event: string | UaEventOptions, params?: any) { ...@@ -18,15 +20,10 @@ export function sendEvent(event: string | UaEventOptions, params?: any) {
return googleAnalytics.sendEvent(event, params) return googleAnalytics.sendEvent(event, params)
} }
export function outboundLink( export function outboundLink({ label }: { label: string }) {
{ sendAnalyticsEvent(InterfaceEventName.EXTERNAL_LINK_CLICK, {
label, label,
}: { })
label: string
},
hitCallback: () => unknown
) {
return googleAnalytics.outboundLink({ label }, hitCallback)
} }
export function sendTiming(timingCategory: any, timingVar: any, timingValue: any, timingLabel: any) { export function sendTiming(timingCategory: any, timingVar: any, timingValue: any, timingLabel: any) {
......
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import type { TransactionResponse } from '@ethersproject/providers' import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { BrowserEvent, InterfaceElementName, InterfaceEventName, LiquidityEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, NONFUNGIBLE_POSITION_MANAGER_ADDRESSES, Percent } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, NONFUNGIBLE_POSITION_MANAGER_ADDRESSES, Percent } from '@uniswap/sdk-core'
import { FeeAmount, NonfungiblePositionManager } from '@uniswap/v3-sdk' import { FeeAmount, NonfungiblePositionManager } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { TraceEvent } from 'analytics' import { sendAnalyticsEvent, TraceEvent, useTrace } from 'analytics'
import { useToggleAccountDrawer } from 'components/AccountDrawer' import { useToggleAccountDrawer } from 'components/AccountDrawer'
import OwnershipWarning from 'components/addLiquidity/OwnershipWarning' import OwnershipWarning from 'components/addLiquidity/OwnershipWarning'
import { sendEvent } from 'components/analytics'
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter' import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
import { isSupportedChain } from 'constants/chains' import { isSupportedChain } from 'constants/chains'
import usePrevious from 'hooks/usePrevious' import usePrevious from 'hooks/usePrevious'
...@@ -56,7 +55,7 @@ import useTransactionDeadline from '../../hooks/useTransactionDeadline' ...@@ -56,7 +55,7 @@ import useTransactionDeadline from '../../hooks/useTransactionDeadline'
import { useV3PositionFromTokenId } from '../../hooks/useV3Positions' import { useV3PositionFromTokenId } from '../../hooks/useV3Positions'
import { Bound, Field } from '../../state/mint/v3/actions' import { Bound, Field } from '../../state/mint/v3/actions'
import { useTransactionAdder } from '../../state/transactions/hooks' import { useTransactionAdder } from '../../state/transactions/hooks'
import { TransactionType } from '../../state/transactions/types' import { TransactionInfo, TransactionType } from '../../state/transactions/types'
import { useUserSlippageToleranceWithDefault } from '../../state/user/hooks' import { useUserSlippageToleranceWithDefault } from '../../state/user/hooks'
import { ThemedText } from '../../theme' import { ThemedText } from '../../theme'
import approveAmountCalldata from '../../utils/approveAmountCalldata' import approveAmountCalldata from '../../utils/approveAmountCalldata'
...@@ -106,6 +105,7 @@ function AddLiquidity() { ...@@ -106,6 +105,7 @@ function AddLiquidity() {
}>() }>()
const { account, chainId, provider } = useWeb3React() const { account, chainId, provider } = useWeb3React()
const theme = useTheme() const theme = useTheme()
const trace = useTrace()
const toggleWalletDrawer = useToggleAccountDrawer() // toggle wallet when disconnected const toggleWalletDrawer = useToggleAccountDrawer() // toggle wallet when disconnected
const addTransaction = useTransactionAdder() const addTransaction = useTransactionAdder()
...@@ -294,7 +294,7 @@ function AddLiquidity() { ...@@ -294,7 +294,7 @@ function AddLiquidity() {
.sendTransaction(newTxn) .sendTransaction(newTxn)
.then((response: TransactionResponse) => { .then((response: TransactionResponse) => {
setAttemptingTxn(false) setAttemptingTxn(false)
addTransaction(response, { const transactionInfo: TransactionInfo = {
type: TransactionType.ADD_LIQUIDITY_V3_POOL, type: TransactionType.ADD_LIQUIDITY_V3_POOL,
baseCurrencyId: currencyId(baseCurrency), baseCurrencyId: currencyId(baseCurrency),
quoteCurrencyId: currencyId(quoteCurrency), quoteCurrencyId: currencyId(quoteCurrency),
...@@ -302,12 +302,13 @@ function AddLiquidity() { ...@@ -302,12 +302,13 @@ function AddLiquidity() {
expectedAmountBaseRaw: parsedAmounts[Field.CURRENCY_A]?.quotient?.toString() ?? '0', expectedAmountBaseRaw: parsedAmounts[Field.CURRENCY_A]?.quotient?.toString() ?? '0',
expectedAmountQuoteRaw: parsedAmounts[Field.CURRENCY_B]?.quotient?.toString() ?? '0', expectedAmountQuoteRaw: parsedAmounts[Field.CURRENCY_B]?.quotient?.toString() ?? '0',
feeAmount: position.pool.fee, feeAmount: position.pool.fee,
}) }
addTransaction(response, transactionInfo)
setTxHash(response.hash) setTxHash(response.hash)
sendEvent({ sendAnalyticsEvent(LiquidityEventName.ADD_LIQUIDITY_SUBMITTED, {
category: 'Liquidity',
action: 'Add',
label: [currencies[Field.CURRENCY_A]?.symbol, currencies[Field.CURRENCY_B]?.symbol].join('/'), label: [currencies[Field.CURRENCY_A]?.symbol, currencies[Field.CURRENCY_B]?.symbol].join('/'),
...trace,
...transactionInfo,
}) })
}) })
}) })
...@@ -434,11 +435,6 @@ function AddLiquidity() { ...@@ -434,11 +435,6 @@ function AddLiquidity() {
const maxPrice = pricesAtLimit[Bound.UPPER] const maxPrice = pricesAtLimit[Bound.UPPER]
if (maxPrice) searchParams.set('maxPrice', maxPrice.toSignificant(5)) if (maxPrice) searchParams.set('maxPrice', maxPrice.toSignificant(5))
setSearchParams(searchParams) setSearchParams(searchParams)
sendEvent({
category: 'Liquidity',
action: 'Full Range Clicked',
})
}, [getSetFullRange, pricesAtLimit, searchParams, setSearchParams]) }, [getSetFullRange, pricesAtLimit, searchParams, setSearchParams])
// START: sync values with query string // START: sync values with query string
......
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import type { TransactionResponse } from '@ethersproject/providers' import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { BrowserEvent, InterfaceElementName, InterfaceEventName, LiquidityEventName } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { TraceEvent } from 'analytics' import { sendAnalyticsEvent, TraceEvent, useTrace } from 'analytics'
import { useToggleAccountDrawer } from 'components/AccountDrawer' import { useToggleAccountDrawer } from 'components/AccountDrawer'
import { sendEvent } from 'components/analytics'
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter' import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink' import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import { V2Unsupported } from 'components/V2Unsupported' import { V2Unsupported } from 'components/V2Unsupported'
...@@ -37,7 +36,7 @@ import { PairState } from '../../hooks/useV2Pairs' ...@@ -37,7 +36,7 @@ import { PairState } from '../../hooks/useV2Pairs'
import { Field } from '../../state/mint/actions' import { Field } from '../../state/mint/actions'
import { useDerivedMintInfo, useMintActionHandlers, useMintState } from '../../state/mint/hooks' import { useDerivedMintInfo, useMintActionHandlers, useMintState } from '../../state/mint/hooks'
import { useTransactionAdder } from '../../state/transactions/hooks' import { useTransactionAdder } from '../../state/transactions/hooks'
import { TransactionType } from '../../state/transactions/types' import { TransactionInfo, TransactionType } from '../../state/transactions/types'
import { useUserSlippageToleranceWithDefault } from '../../state/user/hooks' import { useUserSlippageToleranceWithDefault } from '../../state/user/hooks'
import { ThemedText } from '../../theme' import { ThemedText } from '../../theme'
import { calculateGasMargin } from '../../utils/calculateGasMargin' import { calculateGasMargin } from '../../utils/calculateGasMargin'
...@@ -57,6 +56,7 @@ export default function AddLiquidity() { ...@@ -57,6 +56,7 @@ export default function AddLiquidity() {
const { account, chainId, provider } = useWeb3React() const { account, chainId, provider } = useWeb3React()
const theme = useTheme() const theme = useTheme()
const trace = useTrace()
const currencyA = useCurrency(currencyIdA) const currencyA = useCurrency(currencyIdA)
const currencyB = useCurrency(currencyIdB) const currencyB = useCurrency(currencyIdB)
...@@ -191,20 +191,22 @@ export default function AddLiquidity() { ...@@ -191,20 +191,22 @@ export default function AddLiquidity() {
}).then((response) => { }).then((response) => {
setAttemptingTxn(false) setAttemptingTxn(false)
addTransaction(response, { const transactionInfo: TransactionInfo = {
type: TransactionType.ADD_LIQUIDITY_V2_POOL, type: TransactionType.ADD_LIQUIDITY_V2_POOL,
baseCurrencyId: currencyId(currencyA), baseCurrencyId: currencyId(currencyA),
expectedAmountBaseRaw: parsedAmounts[Field.CURRENCY_A]?.quotient.toString() ?? '0', expectedAmountBaseRaw: parsedAmounts[Field.CURRENCY_A]?.quotient.toString() ?? '0',
quoteCurrencyId: currencyId(currencyB), quoteCurrencyId: currencyId(currencyB),
expectedAmountQuoteRaw: parsedAmounts[Field.CURRENCY_B]?.quotient.toString() ?? '0', expectedAmountQuoteRaw: parsedAmounts[Field.CURRENCY_B]?.quotient.toString() ?? '0',
}) }
addTransaction(response, transactionInfo)
setTxHash(response.hash) setTxHash(response.hash)
sendEvent({ sendAnalyticsEvent(LiquidityEventName.ADD_LIQUIDITY_SUBMITTED, {
category: 'Liquidity',
action: 'Add',
label: [currencies[Field.CURRENCY_A]?.symbol, currencies[Field.CURRENCY_B]?.symbol].join('/'), label: [currencies[Field.CURRENCY_A]?.symbol, currencies[Field.CURRENCY_B]?.symbol].join('/'),
...trace,
...transactionInfo,
}) })
}) })
) )
......
import { Contract } from '@ethersproject/contracts' import { Contract } from '@ethersproject/contracts'
import type { TransactionResponse } from '@ethersproject/providers' import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { LiquidityEventName, LiquiditySource } from '@uniswap/analytics-events'
import { CurrencyAmount, Fraction, Percent, Price, Token, V2_FACTORY_ADDRESSES } from '@uniswap/sdk-core' import { CurrencyAmount, Fraction, Percent, Price, Token, V2_FACTORY_ADDRESSES } from '@uniswap/sdk-core'
import { FeeAmount, Pool, Position, priceToClosestTick, TickMath } from '@uniswap/v3-sdk' import { FeeAmount, Pool, Position, priceToClosestTick, TickMath } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendAnalyticsEvent, useTrace } from 'analytics'
import Badge, { BadgeVariant } from 'components/Badge' import Badge, { BadgeVariant } from 'components/Badge'
import { ButtonConfirmed } from 'components/Button' import { ButtonConfirmed } from 'components/Button'
import { BlueCard, DarkGrayCard, LightCard, YellowCard } from 'components/Card' import { BlueCard, DarkGrayCard, LightCard, YellowCard } from 'components/Card'
...@@ -128,6 +129,7 @@ function V2PairMigration({ ...@@ -128,6 +129,7 @@ function V2PairMigration({
const { chainId, account } = useWeb3React() const { chainId, account } = useWeb3React()
const theme = useTheme() const theme = useTheme()
const v2FactoryAddress = chainId ? V2_FACTORY_ADDRESSES[chainId] : undefined const v2FactoryAddress = chainId ? V2_FACTORY_ADDRESSES[chainId] : undefined
const trace = useTrace()
const pairFactory = useSingleCallResult(pair, 'factory') const pairFactory = useSingleCallResult(pair, 'factory')
const isNotUniswap = pairFactory.result?.[0] && pairFactory.result[0] !== v2FactoryAddress const isNotUniswap = pairFactory.result?.[0] && pairFactory.result[0] !== v2FactoryAddress
...@@ -340,10 +342,10 @@ function V2PairMigration({ ...@@ -340,10 +342,10 @@ function V2PairMigration({
return migrator return migrator
.multicall(data, { gasLimit: calculateGasMargin(gasEstimate) }) .multicall(data, { gasLimit: calculateGasMargin(gasEstimate) })
.then((response: TransactionResponse) => { .then((response: TransactionResponse) => {
sendEvent({ sendAnalyticsEvent(LiquidityEventName.MIGRATE_LIQUIDITY_SUBMITTED, {
category: 'Migrate', action: `${isNotUniswap ? LiquiditySource.SUSHISWAP : LiquiditySource.V2}->${LiquiditySource.V3}`,
action: `${isNotUniswap ? 'SushiSwap' : 'V2'}->V3`,
label: `${currency0.symbol}/${currency1.symbol}`, label: `${currency0.symbol}/${currency1.symbol}`,
...trace,
}) })
addTransaction(response, { addTransaction(response, {
...@@ -380,6 +382,7 @@ function V2PairMigration({ ...@@ -380,6 +382,7 @@ function V2PairMigration({
isNotUniswap, isNotUniswap,
currency0, currency0,
currency1, currency1,
trace,
addTransaction, addTransaction,
]) ])
......
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import type { TransactionResponse } from '@ethersproject/providers' import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { InterfacePageName } from '@uniswap/analytics-events' import { InterfacePageName, LiquidityEventName, LiquiditySource } from '@uniswap/analytics-events'
import { Currency, CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core'
import { NonfungiblePositionManager, Pool, Position } from '@uniswap/v3-sdk' import { NonfungiblePositionManager, Pool, Position } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { Trace } from 'analytics' import { sendAnalyticsEvent, Trace } from 'analytics'
import { sendEvent } from 'components/analytics'
import Badge from 'components/Badge' import Badge from 'components/Badge'
import { ButtonConfirmed, ButtonGray, ButtonPrimary } from 'components/Button' import { ButtonConfirmed, ButtonGray, ButtonPrimary } from 'components/Button'
import { DarkCard, LightCard } from 'components/Card' import { DarkCard, LightCard } from 'components/Card'
...@@ -537,9 +536,8 @@ function PositionPageContent() { ...@@ -537,9 +536,8 @@ function PositionPageContent() {
setCollectMigrationHash(response.hash) setCollectMigrationHash(response.hash)
setCollecting(false) setCollecting(false)
sendEvent({ sendAnalyticsEvent(LiquidityEventName.COLLECT_LIQUIDITY_SUBMITTED, {
category: 'Liquidity', source: LiquiditySource.V3,
action: 'CollectV3',
label: [currency0ForFeeCollectionPurposes.symbol, currency1ForFeeCollectionPurposes.symbol].join('/'), label: [currency0ForFeeCollectionPurposes.symbol, currency1ForFeeCollectionPurposes.symbol].join('/'),
}) })
......
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import type { TransactionResponse } from '@ethersproject/providers' import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { LiquidityEventName, LiquiditySource } from '@uniswap/analytics-events'
import { CurrencyAmount, Percent } from '@uniswap/sdk-core' import { CurrencyAmount, Percent } from '@uniswap/sdk-core'
import { NonfungiblePositionManager } from '@uniswap/v3-sdk' import { NonfungiblePositionManager } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendAnalyticsEvent, useTrace } from 'analytics'
import RangeBadge from 'components/Badge/RangeBadge' import RangeBadge from 'components/Badge/RangeBadge'
import { ButtonConfirmed, ButtonPrimary } from 'components/Button' import { ButtonConfirmed, ButtonPrimary } from 'components/Button'
import { LightCard } from 'components/Card' import { LightCard } from 'components/Card'
...@@ -71,6 +72,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) { ...@@ -71,6 +72,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
const { position } = useV3PositionFromTokenId(tokenId) const { position } = useV3PositionFromTokenId(tokenId)
const theme = useTheme() const theme = useTheme()
const { account, chainId, provider } = useWeb3React() const { account, chainId, provider } = useWeb3React()
const trace = useTrace()
// flag for receiving WETH // flag for receiving WETH
const [receiveWETH, setReceiveWETH] = useState(false) const [receiveWETH, setReceiveWETH] = useState(false)
...@@ -153,10 +155,10 @@ function Remove({ tokenId }: { tokenId: BigNumber }) { ...@@ -153,10 +155,10 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
.getSigner() .getSigner()
.sendTransaction(newTxn) .sendTransaction(newTxn)
.then((response: TransactionResponse) => { .then((response: TransactionResponse) => {
sendEvent({ sendAnalyticsEvent(LiquidityEventName.REMOVE_LIQUIDITY_SUBMITTED, {
category: 'Liquidity', source: LiquiditySource.V3,
action: 'RemoveV3',
label: [liquidityValue0.currency.symbol, liquidityValue1.currency.symbol].join('/'), label: [liquidityValue0.currency.symbol, liquidityValue1.currency.symbol].join('/'),
...trace,
}) })
setTxnHash(response.hash) setTxnHash(response.hash)
setAttemptingTxn(false) setAttemptingTxn(false)
...@@ -180,13 +182,14 @@ function Remove({ tokenId }: { tokenId: BigNumber }) { ...@@ -180,13 +182,14 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
deadline, deadline,
account, account,
chainId, chainId,
feeValue0,
feeValue1,
positionSDK, positionSDK,
liquidityPercentage, liquidityPercentage,
provider, provider,
tokenId, tokenId,
allowedSlippage, allowedSlippage,
feeValue0,
feeValue1,
trace,
addTransaction, addTransaction,
]) ])
......
...@@ -2,12 +2,11 @@ import { BigNumber } from '@ethersproject/bignumber' ...@@ -2,12 +2,11 @@ import { BigNumber } from '@ethersproject/bignumber'
import { Contract } from '@ethersproject/contracts' import { Contract } from '@ethersproject/contracts'
import type { TransactionResponse } from '@ethersproject/providers' import type { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events' import { BrowserEvent, InterfaceElementName, InterfaceEventName, LiquidityEventName } from '@uniswap/analytics-events'
import { Currency, Percent } from '@uniswap/sdk-core' import { Currency, Percent } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core' import { useWeb3React } from '@web3-react/core'
import { TraceEvent } from 'analytics' import { sendAnalyticsEvent, TraceEvent, useTrace } from 'analytics'
import { useToggleAccountDrawer } from 'components/AccountDrawer' import { useToggleAccountDrawer } from 'components/AccountDrawer'
import { sendEvent } from 'components/analytics'
import { V2Unsupported } from 'components/V2Unsupported' import { V2Unsupported } from 'components/V2Unsupported'
import { isSupportedChain } from 'constants/chains' import { isSupportedChain } from 'constants/chains'
import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2' import { useNetworkSupportsV2 } from 'hooks/useNetworkSupportsV2'
...@@ -68,6 +67,7 @@ function RemoveLiquidity() { ...@@ -68,6 +67,7 @@ function RemoveLiquidity() {
const [tokenA, tokenB] = useMemo(() => [currencyA?.wrapped, currencyB?.wrapped], [currencyA, currencyB]) const [tokenA, tokenB] = useMemo(() => [currencyA?.wrapped, currencyB?.wrapped], [currencyA, currencyB])
const theme = useTheme() const theme = useTheme()
const trace = useTrace()
// toggle wallet when disconnected // toggle wallet when disconnected
const toggleWalletDrawer = useToggleAccountDrawer() const toggleWalletDrawer = useToggleAccountDrawer()
...@@ -291,10 +291,9 @@ function RemoveLiquidity() { ...@@ -291,10 +291,9 @@ function RemoveLiquidity() {
setTxHash(response.hash) setTxHash(response.hash)
sendEvent({ sendAnalyticsEvent(LiquidityEventName.REMOVE_LIQUIDITY_SUBMITTED, {
category: 'Liquidity',
action: 'Remove',
label: [currencyA.symbol, currencyB.symbol].join('/'), label: [currencyA.symbol, currencyB.symbol].join('/'),
...trace,
}) })
}) })
.catch((error: Error) => { .catch((error: Error) => {
......
...@@ -173,15 +173,11 @@ function handleClickExternalLink(event: React.MouseEvent<HTMLAnchorElement>) { ...@@ -173,15 +173,11 @@ function handleClickExternalLink(event: React.MouseEvent<HTMLAnchorElement>) {
// don't prevent default, don't redirect if it's a new tab // don't prevent default, don't redirect if it's a new tab
if (target === '_blank' || event.ctrlKey || event.metaKey) { if (target === '_blank' || event.ctrlKey || event.metaKey) {
outboundLink({ label: anonymizedHref }, () => { outboundLink({ label: anonymizedHref })
console.debug('Fired outbound link event', anonymizedHref)
})
} else { } else {
event.preventDefault() event.preventDefault()
// send a ReactGA event and then trigger a location change // send a ReactGA event and then trigger a location change
outboundLink({ label: anonymizedHref }, () => { outboundLink({ label: anonymizedHref })
window.location.href = anonymizedHref
})
} }
} }
......
...@@ -6045,10 +6045,10 @@ ...@@ -6045,10 +6045,10 @@
"@typescript-eslint/types" "5.59.1" "@typescript-eslint/types" "5.59.1"
eslint-visitor-keys "^3.3.0" eslint-visitor-keys "^3.3.0"
"@uniswap/analytics-events@^2.18.0": "@uniswap/analytics-events@^2.19.1":
version "2.18.0" version "2.19.1"
resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.18.0.tgz#22d38adcbe9c18aec7109e562fd005c0e4082edc" resolved "https://registry.yarnpkg.com/@uniswap/analytics-events/-/analytics-events-2.19.1.tgz#943a16b1ff1a43439af38c6e26f5f8583cd1afd7"
integrity sha512-raJP1/xLnunxLwu6XyM4kRJuuIb4aHFR5X9fAovpR6gllpbHicwdjPnjKR5Z8DAnFe5ClFBT0T/foyE5SU5oQQ== integrity sha512-22sdQ4dG+oYnRC9sJ62Cp3ZzwPqEPIkVlrndBGMpmCNXwCd6QeWdvsAP8rCZh+B8hlBieuPlxkiTlPDux6X7kw==
"@uniswap/analytics@^1.4.0": "@uniswap/analytics@^1.4.0":
version "1.4.0" version "1.4.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