track search, track charity donation

This commit is contained in:
mantikoros 2022-06-16 11:49:57 -05:00
parent 6c6f03e622
commit d2a1af7c15
2 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import { defaults, debounce } from 'lodash'
import { useRouter } from 'next/router'
import { useEffect, useMemo, useState } from 'react'
import { useSearchBox } from 'react-instantsearch-hooks-web'
import { track } from 'web/lib/service/analytics'
const MARKETS_SORT = 'markets_sort'
@ -86,6 +87,7 @@ export function useUpdateQueryAndSort(props: {
delete router.query.q
}
router.push(router, undefined, { shallow: true })
track('search', { query })
}, 500),
[router]
)

View File

@ -20,6 +20,7 @@ import Confetti from 'react-confetti'
import { Donation } from 'web/components/charity/feed-items'
import Image from 'next/image'
import { manaToUSD } from '../../../common/util/format'
import { track } from 'web/lib/service/analytics'
export default function CharityPageWrapper() {
const router = useRouter()
@ -179,6 +180,7 @@ function DonationBox(props: {
e.preventDefault()
setIsSubmitting(true)
setError(undefined)
await transact({
amount,
fromId: user.id,
@ -189,9 +191,11 @@ function DonationBox(props: {
category: 'CHARITY',
description: `${user.name} donated M$ ${amount} to ${charity.name}`,
}).catch((err) => console.log('Error', err))
setIsSubmitting(false)
setAmount(undefined)
setShowConfetti(true)
track('donation', { charityId: charity.id, amount })
}
return (