Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

track bet intent and bets in Amplitude #2892

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions web/components/bet/bet-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ export function BuyPanel(props: {
setOutcome(undefined)
setIsPanelBodyVisible(false)
} else {
// TODO: Twomba tracking bet terminology
track('bet intent', { location, option: outcome })
track('bet intent', { location, option: outcome, token: contract.token })

setOutcome(choice)
setIsPanelBodyVisible(true)
Expand Down Expand Up @@ -361,12 +360,12 @@ export const BuyPanelBody = (props: {
console.log(`placed ${TRADE_TERM}. Result:`, bet)
setBetAmount(undefined)
if (onBuySuccess) onBuySuccess()
// TODO: Twomba tracking bet terminology
track(
'bet',
removeUndefinedProps({
location,
outcomeType: contract.outcomeType,
token: contract.token,
slug: contract.slug,
contractId: contract.id,
amount: betAmount,
Expand Down Expand Up @@ -482,7 +481,6 @@ export const BuyPanelBody = (props: {
.concat(result.ordersToCancel)
}
} catch (err: any) {
// TODO: Twomba tracking bet terminology
console.error('Error in calculateCpmmMultiArbitrageBet:', err)
setError(
err?.message ??
Expand Down Expand Up @@ -768,8 +766,9 @@ export const BuyPanelBody = (props: {
<Button
color={outcome === 'NO' ? 'red' : 'green'}
size="xl"
// TODO: Twomba tracking bet terminology
onClick={withTracking(firebaseLogin, 'login from bet panel')}
onClick={withTracking(firebaseLogin, 'login from bet panel', {
token: contract.token,
})}
className="flex-grow"
>
Sign up to predict
Expand Down
7 changes: 5 additions & 2 deletions web/components/bet/feed-bet-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ export function BetButton(props: {
firebaseLogin()
return
}
// TODO: Twomba tracking bet terminology
track('bet intent', { location: 'feed card', outcome })
track('bet intent', {
location: 'feed card',
outcome,
token: contract.token,
})
setDialogueThatIsOpen(outcome)
}

Expand Down
3 changes: 1 addition & 2 deletions web/components/bet/limit-order-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ export default function LimitOrderPanel(props: {
console.log(`placed ${TRADE_TERM}. Result:`, bet)
if (onBuySuccess) onBuySuccess()

// TODO: Twomba tracking bet terminology
await track('bet', {
location: 'bet panel',
outcomeType: contract.outcomeType,
Expand All @@ -237,6 +236,7 @@ export default function LimitOrderPanel(props: {
limitProb: limitProb,
isLimitOrder: true,
answerId: multiProps?.answerToBuy.id,
token: contract.token,
})
} catch (e) {
if (e instanceof APIError) {
Expand Down Expand Up @@ -275,7 +275,6 @@ export default function LimitOrderPanel(props: {
fees = result.fees
betDeps.current = result.betDeps
} catch (err: any) {
// TODO: Twomba tracking bet terminology
console.error('Error in calculateCpmmMultiArbitrageBet:', err)
setError(
err?.message ??
Expand Down
2 changes: 1 addition & 1 deletion web/components/bet/quick-limit-order-buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export const QuickLimitOrderButtons = (props: {
setIsSubmitting(false)
})

// TODO: Twomba tracking bet terminology
await track(
'bet',
removeUndefinedProps({
location: 'quick bet panel',
outcomeType: contract.outcomeType,
token: contract.token,
slug: contract.slug,
contractId: contract.id,
amount,
Expand Down
6 changes: 4 additions & 2 deletions web/components/comments/comment-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ export function CommentActions(props: {
{user && liveContract.outcomeType === 'BINARY' && !isCashContract && (
<IconButton
onClick={() => {
// TODO: Twomba tracking bet terminology
track('bet intent', { location: 'comment on contract' })
track('bet intent', {
location: 'comment on contract',
token: liveContract.token,
})
setOutcome('YES')
setShowBetModal(true)
}}
Expand Down
1 change: 0 additions & 1 deletion web/components/comments/comment-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ export function ContractCommentInput(props: {
}
clearReply?.()
onSubmit?.(comment)
// TODO: Twomba tracking bet terminology
await track(type, {
location: trackingLocation,
replyTo: isReplyToBet
Expand Down
6 changes: 4 additions & 2 deletions web/components/contract/contract-table-action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ export function BetButton(props: {
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
// TODO: Twomba tracking bet terminology
track('bet intent', { location: 'contract table' })
track('bet intent', {
location: 'contract table',
token: contract.token,
})
if (!user) {
firebaseLogin()
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,10 @@ export const BinaryBetButton = (props: { contract: BinaryContract }) => {
className="bg-primary-50 h-fit w-fit"
onClick={(e) => {
e.stopPropagation()
// TODO: Twomba tracking bet terminology
track('bet intent', { location: 'binary panel' })
track('bet intent', {
location: 'binary panel',
token: contract.token,
})
setOutcome('YES')
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,10 @@ export function BinaryBetButton(props: {
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
// TODO: Twomba tracking bet terminology
track('bet intent', { location: 'contract table' })
track('bet intent', {
location: 'contract table',
token: contract.token,
})
if (!user) {
firebaseLogin()
return
Expand Down
5 changes: 3 additions & 2 deletions web/components/usa-map/house-table-helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ export const BuyPanelBody = (props: {
<Button
color={outcome === 'NO' ? 'red' : 'green'}
size="xl"
// TODO: Twomba tracking bet terminology
onClick={withTracking(firebaseLogin, 'login from bet panel')}
onClick={withTracking(firebaseLogin, 'login from bet panel', {
token: contract.token,
})}
className="flex-grow"
>
Sign up to predict
Expand Down
Loading