Add tracking for clicking recommended card & tournament card
This commit is contained in:
parent
6c64c9f1cd
commit
71dfcc4dd9
|
@ -43,6 +43,7 @@ export function ContractCard(props: {
|
||||||
onClick?: () => void
|
onClick?: () => void
|
||||||
hideQuickBet?: boolean
|
hideQuickBet?: boolean
|
||||||
hideGroupLink?: boolean
|
hideGroupLink?: boolean
|
||||||
|
trackingPostfix?: string
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
showHotVolume,
|
showHotVolume,
|
||||||
|
@ -52,6 +53,7 @@ export function ContractCard(props: {
|
||||||
onClick,
|
onClick,
|
||||||
hideQuickBet,
|
hideQuickBet,
|
||||||
hideGroupLink,
|
hideGroupLink,
|
||||||
|
trackingPostfix,
|
||||||
} = props
|
} = props
|
||||||
const contract = useContractWithPreload(props.contract) ?? props.contract
|
const contract = useContractWithPreload(props.contract) ?? props.contract
|
||||||
const { question, outcomeType } = contract
|
const { question, outcomeType } = contract
|
||||||
|
@ -166,7 +168,7 @@ export function ContractCard(props: {
|
||||||
if (e.ctrlKey || e.metaKey) return
|
if (e.ctrlKey || e.metaKey) return
|
||||||
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
track('click market card', {
|
track('click market card' + (trackingPostfix ?? ''), {
|
||||||
slug: contract.slug,
|
slug: contract.slug,
|
||||||
contractId: contract.id,
|
contractId: contract.id,
|
||||||
})
|
})
|
||||||
|
@ -176,10 +178,13 @@ export function ContractCard(props: {
|
||||||
) : (
|
) : (
|
||||||
<Link href={contractPath(contract)}>
|
<Link href={contractPath(contract)}>
|
||||||
<a
|
<a
|
||||||
onClick={trackCallback('click market card', {
|
onClick={trackCallback(
|
||||||
slug: contract.slug,
|
'click market card' + (trackingPostfix ?? ''),
|
||||||
contractId: contract.id,
|
{
|
||||||
})}
|
slug: contract.slug,
|
||||||
|
contractId: contract.id,
|
||||||
|
}
|
||||||
|
)}
|
||||||
className="absolute top-0 left-0 right-0 bottom-0"
|
className="absolute top-0 left-0 right-0 bottom-0"
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -26,6 +26,7 @@ export function ContractsGrid(props: {
|
||||||
hideGroupLink?: boolean
|
hideGroupLink?: boolean
|
||||||
}
|
}
|
||||||
highlightOptions?: ContractHighlightOptions
|
highlightOptions?: ContractHighlightOptions
|
||||||
|
trackingPostfix?: string
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
contracts,
|
contracts,
|
||||||
|
@ -34,6 +35,7 @@ export function ContractsGrid(props: {
|
||||||
onContractClick,
|
onContractClick,
|
||||||
cardHideOptions,
|
cardHideOptions,
|
||||||
highlightOptions,
|
highlightOptions,
|
||||||
|
trackingPostfix,
|
||||||
} = props
|
} = props
|
||||||
const { hideQuickBet, hideGroupLink } = cardHideOptions || {}
|
const { hideQuickBet, hideGroupLink } = cardHideOptions || {}
|
||||||
const { contractIds, highlightClassName } = highlightOptions || {}
|
const { contractIds, highlightClassName } = highlightOptions || {}
|
||||||
|
@ -79,6 +81,7 @@ export function ContractsGrid(props: {
|
||||||
}
|
}
|
||||||
hideQuickBet={hideQuickBet}
|
hideQuickBet={hideQuickBet}
|
||||||
hideGroupLink={hideGroupLink}
|
hideGroupLink={hideGroupLink}
|
||||||
|
trackingPostfix={trackingPostfix}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'mb-4 break-inside-avoid-column overflow-hidden', // prevent content from wrapping (needs overflow on firefox)
|
'mb-4 break-inside-avoid-column overflow-hidden', // prevent content from wrapping (needs overflow on firefox)
|
||||||
contractIds?.includes(contract.id) && highlightClassName
|
contractIds?.includes(contract.id) && highlightClassName
|
||||||
|
|
|
@ -285,7 +285,10 @@ export function ContractPageContent(
|
||||||
{recommendedContracts.length > 0 && (
|
{recommendedContracts.length > 0 && (
|
||||||
<Col className="mt-2 gap-2 px-2 sm:px-0">
|
<Col className="mt-2 gap-2 px-2 sm:px-0">
|
||||||
<Title className="text-gray-700" text="Recommended" />
|
<Title className="text-gray-700" text="Recommended" />
|
||||||
<ContractsGrid contracts={recommendedContracts} />
|
<ContractsGrid
|
||||||
|
contracts={recommendedContracts}
|
||||||
|
trackingPostfix=" recommended"
|
||||||
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
)}
|
)}
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -215,6 +215,7 @@ function Section(props: {
|
||||||
hideGroupLink
|
hideGroupLink
|
||||||
className="max-h-[200px] w-96 shrink-0"
|
className="max-h-[200px] w-96 shrink-0"
|
||||||
questionClass="line-clamp-3"
|
questionClass="line-clamp-3"
|
||||||
|
trackingPostfix=" tournament"
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user