track search, track charity donation
This commit is contained in:
parent
6c6f03e622
commit
d2a1af7c15
|
@ -2,6 +2,7 @@ import { defaults, debounce } from 'lodash'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { useEffect, useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { useSearchBox } from 'react-instantsearch-hooks-web'
|
import { useSearchBox } from 'react-instantsearch-hooks-web'
|
||||||
|
import { track } from 'web/lib/service/analytics'
|
||||||
|
|
||||||
const MARKETS_SORT = 'markets_sort'
|
const MARKETS_SORT = 'markets_sort'
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ export function useUpdateQueryAndSort(props: {
|
||||||
delete router.query.q
|
delete router.query.q
|
||||||
}
|
}
|
||||||
router.push(router, undefined, { shallow: true })
|
router.push(router, undefined, { shallow: true })
|
||||||
|
track('search', { query })
|
||||||
}, 500),
|
}, 500),
|
||||||
[router]
|
[router]
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,6 +20,7 @@ import Confetti from 'react-confetti'
|
||||||
import { Donation } from 'web/components/charity/feed-items'
|
import { Donation } from 'web/components/charity/feed-items'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { manaToUSD } from '../../../common/util/format'
|
import { manaToUSD } from '../../../common/util/format'
|
||||||
|
import { track } from 'web/lib/service/analytics'
|
||||||
|
|
||||||
export default function CharityPageWrapper() {
|
export default function CharityPageWrapper() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
@ -179,6 +180,7 @@ function DonationBox(props: {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
setIsSubmitting(true)
|
setIsSubmitting(true)
|
||||||
setError(undefined)
|
setError(undefined)
|
||||||
|
|
||||||
await transact({
|
await transact({
|
||||||
amount,
|
amount,
|
||||||
fromId: user.id,
|
fromId: user.id,
|
||||||
|
@ -189,9 +191,11 @@ function DonationBox(props: {
|
||||||
category: 'CHARITY',
|
category: 'CHARITY',
|
||||||
description: `${user.name} donated M$ ${amount} to ${charity.name}`,
|
description: `${user.name} donated M$ ${amount} to ${charity.name}`,
|
||||||
}).catch((err) => console.log('Error', err))
|
}).catch((err) => console.log('Error', err))
|
||||||
|
|
||||||
setIsSubmitting(false)
|
setIsSubmitting(false)
|
||||||
setAmount(undefined)
|
setAmount(undefined)
|
||||||
setShowConfetti(true)
|
setShowConfetti(true)
|
||||||
|
track('donation', { charityId: charity.id, amount })
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user