track midterms, date docs

This commit is contained in:
mantikoros 2022-10-09 17:02:28 -05:00
parent 8bd21c6693
commit 565177b76f
3 changed files with 13 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import { CPMMBinaryContract } from 'common/contract'
import { Customize, USAMap } from './usa-map' import { Customize, USAMap } from './usa-map'
import { listenForContract } from 'web/lib/firebase/contracts' import { listenForContract } from 'web/lib/firebase/contracts'
import { interpolateColor } from 'common/util/color' import { interpolateColor } from 'common/util/color'
import { track } from 'web/lib/service/analytics'
export interface StateElectionMarket { export interface StateElectionMarket {
creatorUsername: string creatorUsername: string
@ -35,8 +36,13 @@ export function StateElectionMap(props: {
market.state, market.state,
{ {
fill: probToColor(prob, market.isWinRepublican), fill: probToColor(prob, market.isWinRepublican),
clickHandler: () => clickHandler: () => {
Router.push(`/${market.creatorUsername}/${market.slug}`), Router.push(`/${market.creatorUsername}/${market.slug}`)
track('state election map click', {
state: market.state,
slug: market.slug,
})
},
}, },
]) ])

View File

@ -14,6 +14,7 @@ import { getUser, User } from 'web/lib/firebase/users'
import { DateDocPost } from './[username]' import { DateDocPost } from './[username]'
import { NoSEO } from 'web/components/NoSEO' import { NoSEO } from 'web/components/NoSEO'
import { useDateDocs } from 'web/hooks/use-post' import { useDateDocs } from 'web/hooks/use-post'
import { useTracking } from 'web/hooks/use-tracking'
export async function getStaticProps() { export async function getStaticProps() {
const dateDocs = await getDateDocs() const dateDocs = await getDateDocs()
@ -40,6 +41,7 @@ export default function DatePage(props: {
const dateDocs = useDateDocs() ?? props.dateDocs const dateDocs = useDateDocs() ?? props.dateDocs
const hasDoc = dateDocs.some((d) => d.creatorId === user?.id) const hasDoc = dateDocs.some((d) => d.creatorId === user?.id)
useTracking('view date docs page')
return ( return (
<Page> <Page>

View File

@ -8,6 +8,7 @@ import {
StateElectionMarket, StateElectionMarket,
StateElectionMap, StateElectionMap,
} from 'web/components/usa-map/state-election-map' } from 'web/components/usa-map/state-election-map'
import { useTracking } from 'web/hooks/use-tracking'
import { getContractFromSlug } from 'web/lib/firebase/contracts' import { getContractFromSlug } from 'web/lib/firebase/contracts'
const senateMidterms: StateElectionMarket[] = [ const senateMidterms: StateElectionMarket[] = [
@ -203,6 +204,8 @@ const App = (props: {
}) => { }) => {
const { senateContracts, governorContracts } = props const { senateContracts, governorContracts } = props
useTracking('view midterms 2022')
return ( return (
<Page className=""> <Page className="">
<Col className="items-center justify-center"> <Col className="items-center justify-center">