2022-03-03 01:52:41 +00:00
|
|
|
import dayjs from 'dayjs'
|
2022-06-11 04:22:47 +00:00
|
|
|
import { zip, uniq, sumBy, concat, countBy, sortBy, sum } from 'lodash'
|
2022-03-22 21:24:26 +00:00
|
|
|
import {
|
|
|
|
DailyCountChart,
|
|
|
|
DailyPercentChart,
|
2022-05-09 13:04:36 +00:00
|
|
|
} from 'web/components/analytics/charts'
|
|
|
|
import { Col } from 'web/components/layout/col'
|
|
|
|
import { Spacer } from 'web/components/layout/spacer'
|
|
|
|
import { Tabs } from 'web/components/layout/tabs'
|
|
|
|
import { Page } from 'web/components/page'
|
|
|
|
import { Title } from 'web/components/title'
|
|
|
|
import { fromPropz, usePropz } from 'web/hooks/use-propz'
|
|
|
|
import { getDailyBets } from 'web/lib/firebase/bets'
|
|
|
|
import { getDailyComments } from 'web/lib/firebase/comments'
|
|
|
|
import { getDailyContracts } from 'web/lib/firebase/contracts'
|
|
|
|
import { getDailyNewUsers } from 'web/lib/firebase/users'
|
2022-05-31 15:32:11 +00:00
|
|
|
import { SiteLink } from 'web/components/site-link'
|
|
|
|
import { Linkify } from 'web/components/linkify'
|
2022-01-17 18:34:28 +00:00
|
|
|
|
2022-03-09 02:43:30 +00:00
|
|
|
export const getStaticProps = fromPropz(getStaticPropz)
|
|
|
|
export async function getStaticPropz() {
|
2022-05-26 02:22:50 +00:00
|
|
|
const numberOfDays = 90
|
2022-05-22 22:35:10 +00:00
|
|
|
const today = dayjs(dayjs().format('YYYY-MM-DD'))
|
2022-05-19 20:14:13 +00:00
|
|
|
// Convert from UTC midnight to PT midnight.
|
|
|
|
.add(7, 'hours')
|
2022-05-18 22:53:53 +00:00
|
|
|
|
2022-05-22 22:35:10 +00:00
|
|
|
const startDate = today.subtract(numberOfDays, 'day')
|
2022-03-03 01:52:41 +00:00
|
|
|
|
2022-04-19 06:47:58 +00:00
|
|
|
const [dailyBets, dailyContracts, dailyComments, dailyNewUsers] =
|
|
|
|
await Promise.all([
|
|
|
|
getDailyBets(startDate.valueOf(), numberOfDays),
|
|
|
|
getDailyContracts(startDate.valueOf(), numberOfDays),
|
|
|
|
getDailyComments(startDate.valueOf(), numberOfDays),
|
|
|
|
getDailyNewUsers(startDate.valueOf(), numberOfDays),
|
|
|
|
])
|
2022-03-03 01:52:41 +00:00
|
|
|
|
2022-03-03 20:59:12 +00:00
|
|
|
const dailyBetCounts = dailyBets.map((bets) => bets.length)
|
2022-03-03 01:52:41 +00:00
|
|
|
const dailyContractCounts = dailyContracts.map(
|
|
|
|
(contracts) => contracts.length
|
|
|
|
)
|
2022-03-03 20:59:12 +00:00
|
|
|
const dailyCommentCounts = dailyComments.map((comments) => comments.length)
|
|
|
|
|
2022-05-22 08:36:05 +00:00
|
|
|
const dailyUserIds = zip(dailyContracts, dailyBets, dailyComments).map(
|
2022-03-03 20:59:12 +00:00
|
|
|
([contracts, bets, comments]) => {
|
|
|
|
const creatorIds = (contracts ?? []).map((c) => c.creatorId)
|
|
|
|
const betUserIds = (bets ?? []).map((bet) => bet.userId)
|
|
|
|
const commentUserIds = (comments ?? []).map((comment) => comment.userId)
|
2022-05-22 08:36:05 +00:00
|
|
|
return uniq([...creatorIds, ...betUserIds, ...commentUserIds])
|
2022-03-03 20:59:12 +00:00
|
|
|
}
|
|
|
|
)
|
2022-03-03 01:52:41 +00:00
|
|
|
|
2022-03-20 21:23:25 +00:00
|
|
|
const dailyActiveUsers = dailyUserIds.map((userIds) => userIds.length)
|
|
|
|
|
2022-03-21 22:42:06 +00:00
|
|
|
const weeklyActiveUsers = dailyUserIds.map((_, i) => {
|
|
|
|
const start = Math.max(0, i - 6)
|
|
|
|
const end = i
|
|
|
|
const uniques = new Set<string>()
|
|
|
|
for (let j = start; j <= end; j++)
|
|
|
|
dailyUserIds[j].forEach((userId) => uniques.add(userId))
|
|
|
|
return uniques.size
|
|
|
|
})
|
|
|
|
|
2022-03-20 21:23:25 +00:00
|
|
|
const monthlyActiveUsers = dailyUserIds.map((_, i) => {
|
|
|
|
const start = Math.max(0, i - 30)
|
|
|
|
const end = i
|
|
|
|
const uniques = new Set<string>()
|
|
|
|
for (let j = start; j <= end; j++)
|
|
|
|
dailyUserIds[j].forEach((userId) => uniques.add(userId))
|
|
|
|
return uniques.size
|
|
|
|
})
|
|
|
|
|
2022-03-22 21:24:26 +00:00
|
|
|
const weekOnWeekRetention = dailyUserIds.map((_userId, i) => {
|
|
|
|
const twoWeeksAgo = {
|
|
|
|
start: Math.max(0, i - 13),
|
|
|
|
end: Math.max(0, i - 7),
|
|
|
|
}
|
|
|
|
const lastWeek = {
|
|
|
|
start: Math.max(0, i - 6),
|
|
|
|
end: i,
|
|
|
|
}
|
|
|
|
|
|
|
|
const activeTwoWeeksAgo = new Set<string>()
|
|
|
|
for (let j = twoWeeksAgo.start; j <= twoWeeksAgo.end; j++) {
|
|
|
|
dailyUserIds[j].forEach((userId) => activeTwoWeeksAgo.add(userId))
|
|
|
|
}
|
|
|
|
const activeLastWeek = new Set<string>()
|
|
|
|
for (let j = lastWeek.start; j <= lastWeek.end; j++) {
|
|
|
|
dailyUserIds[j].forEach((userId) => activeLastWeek.add(userId))
|
|
|
|
}
|
2022-05-22 08:36:05 +00:00
|
|
|
const retainedCount = sumBy(Array.from(activeTwoWeeksAgo), (userId) =>
|
2022-03-22 21:24:26 +00:00
|
|
|
activeLastWeek.has(userId) ? 1 : 0
|
|
|
|
)
|
|
|
|
const retainedFrac = retainedCount / activeTwoWeeksAgo.size
|
|
|
|
return Math.round(retainedFrac * 100 * 100) / 100
|
|
|
|
})
|
|
|
|
|
2022-04-19 06:57:27 +00:00
|
|
|
const monthlyRetention = dailyUserIds.map((_userId, i) => {
|
|
|
|
const twoMonthsAgo = {
|
|
|
|
start: Math.max(0, i - 60),
|
|
|
|
end: Math.max(0, i - 30),
|
|
|
|
}
|
|
|
|
const lastMonth = {
|
|
|
|
start: Math.max(0, i - 30),
|
|
|
|
end: i,
|
|
|
|
}
|
|
|
|
|
|
|
|
const activeTwoMonthsAgo = new Set<string>()
|
|
|
|
for (let j = twoMonthsAgo.start; j <= twoMonthsAgo.end; j++) {
|
|
|
|
dailyUserIds[j].forEach((userId) => activeTwoMonthsAgo.add(userId))
|
|
|
|
}
|
|
|
|
const activeLastMonth = new Set<string>()
|
|
|
|
for (let j = lastMonth.start; j <= lastMonth.end; j++) {
|
|
|
|
dailyUserIds[j].forEach((userId) => activeLastMonth.add(userId))
|
|
|
|
}
|
2022-05-22 08:36:05 +00:00
|
|
|
const retainedCount = sumBy(Array.from(activeTwoMonthsAgo), (userId) =>
|
2022-04-19 06:57:27 +00:00
|
|
|
activeLastMonth.has(userId) ? 1 : 0
|
|
|
|
)
|
|
|
|
const retainedFrac = retainedCount / activeTwoMonthsAgo.size
|
|
|
|
return Math.round(retainedFrac * 100 * 100) / 100
|
|
|
|
})
|
|
|
|
|
2022-04-19 06:47:58 +00:00
|
|
|
const firstBetDict: { [userId: string]: number } = {}
|
|
|
|
for (let i = 0; i < dailyBets.length; i++) {
|
|
|
|
const bets = dailyBets[i]
|
|
|
|
for (const bet of bets) {
|
|
|
|
if (bet.userId in firstBetDict) continue
|
|
|
|
firstBetDict[bet.userId] = i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const weeklyActivationRate = dailyNewUsers.map((_, i) => {
|
|
|
|
const start = Math.max(0, i - 6)
|
|
|
|
const end = i
|
|
|
|
let activatedCount = 0
|
|
|
|
let newUsers = 0
|
|
|
|
for (let j = start; j <= end; j++) {
|
|
|
|
const userIds = dailyNewUsers[j].map((user) => user.id)
|
|
|
|
newUsers += userIds.length
|
|
|
|
for (const userId of userIds) {
|
|
|
|
const dayIndex = firstBetDict[userId]
|
|
|
|
if (dayIndex !== undefined && dayIndex <= end) {
|
|
|
|
activatedCount++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const frac = activatedCount / (newUsers || 1)
|
|
|
|
return Math.round(frac * 100 * 100) / 100
|
|
|
|
})
|
2022-05-19 21:13:30 +00:00
|
|
|
const dailySignups = dailyNewUsers.map((users) => users.length)
|
2022-04-19 06:47:58 +00:00
|
|
|
|
2022-06-11 04:22:47 +00:00
|
|
|
const dailyTopTenthActions = zip(
|
|
|
|
dailyContracts,
|
|
|
|
dailyBets,
|
|
|
|
dailyComments
|
|
|
|
).map(([contracts, bets, comments]) => {
|
|
|
|
const userIds = concat(
|
|
|
|
contracts?.map((c) => c.creatorId) ?? [],
|
|
|
|
bets?.map((b) => b.userId) ?? [],
|
|
|
|
comments?.map((c) => c.userId) ?? []
|
|
|
|
)
|
2022-06-13 20:51:15 +00:00
|
|
|
const counts = Object.values(countBy(userIds))
|
|
|
|
const sortedCounts = sortBy(counts, (count) => count).reverse()
|
|
|
|
if (sortedCounts.length === 0) return 0
|
|
|
|
const tenthPercentile = sortedCounts[Math.floor(sortedCounts.length * 0.1)]
|
|
|
|
return tenthPercentile
|
2022-06-11 04:22:47 +00:00
|
|
|
})
|
|
|
|
const weeklyTopTenthActions = dailyTopTenthActions.map((_, i) => {
|
|
|
|
const start = Math.max(0, i - 6)
|
|
|
|
const end = i
|
|
|
|
const total = sum(dailyTopTenthActions.slice(start, end))
|
|
|
|
if (end - start < 7) return (total * 7) / (end - start)
|
|
|
|
return total
|
|
|
|
})
|
|
|
|
const monthlyTopTenthActions = dailyTopTenthActions.map((_, i) => {
|
|
|
|
const start = Math.max(0, i - 29)
|
|
|
|
const end = i
|
|
|
|
const total = sum(dailyTopTenthActions.slice(start, end))
|
|
|
|
if (end - start < 30) return (total * 30) / (end - start)
|
|
|
|
return total
|
|
|
|
})
|
|
|
|
|
2022-06-11 04:44:19 +00:00
|
|
|
// Total mana divided by 100.
|
|
|
|
const dailyManaBet = dailyBets.map((bets) => {
|
|
|
|
return Math.round(sumBy(bets, (bet) => bet.amount) / 100)
|
|
|
|
})
|
|
|
|
const weeklyManaBet = dailyManaBet.map((_, i) => {
|
|
|
|
const start = Math.max(0, i - 6)
|
|
|
|
const end = i
|
|
|
|
const total = sum(dailyManaBet.slice(start, end))
|
|
|
|
if (end - start < 7) return (total * 7) / (end - start)
|
|
|
|
return total
|
|
|
|
})
|
|
|
|
const monthlyManaBet = dailyManaBet.map((_, i) => {
|
|
|
|
const start = Math.max(0, i - 29)
|
|
|
|
const end = i
|
|
|
|
const total = sum(dailyManaBet.slice(start, end))
|
|
|
|
if (end - start < 30) return (total * 30) / (end - start)
|
|
|
|
return total
|
|
|
|
})
|
|
|
|
|
2022-03-03 01:52:41 +00:00
|
|
|
return {
|
|
|
|
props: {
|
2022-05-19 20:53:49 +00:00
|
|
|
startDate: startDate.valueOf(),
|
2022-03-03 20:59:12 +00:00
|
|
|
dailyActiveUsers,
|
2022-03-21 22:42:06 +00:00
|
|
|
weeklyActiveUsers,
|
|
|
|
monthlyActiveUsers,
|
2022-03-03 01:52:41 +00:00
|
|
|
dailyBetCounts,
|
|
|
|
dailyContractCounts,
|
2022-03-03 20:59:12 +00:00
|
|
|
dailyCommentCounts,
|
2022-05-19 21:13:30 +00:00
|
|
|
dailySignups,
|
2022-03-22 21:24:26 +00:00
|
|
|
weekOnWeekRetention,
|
2022-04-19 06:47:58 +00:00
|
|
|
weeklyActivationRate,
|
2022-04-19 06:57:27 +00:00
|
|
|
monthlyRetention,
|
2022-06-13 20:51:15 +00:00
|
|
|
topTenthActions: {
|
|
|
|
daily: dailyTopTenthActions,
|
|
|
|
weekly: weeklyTopTenthActions,
|
|
|
|
monthly: monthlyTopTenthActions,
|
|
|
|
},
|
2022-06-11 04:44:19 +00:00
|
|
|
manaBet: {
|
|
|
|
daily: dailyManaBet,
|
|
|
|
weekly: weeklyManaBet,
|
|
|
|
monthly: monthlyManaBet,
|
|
|
|
},
|
2022-03-03 01:52:41 +00:00
|
|
|
},
|
2022-05-18 22:53:53 +00:00
|
|
|
revalidate: 60 * 60, // Regenerate after an hour
|
2022-03-03 01:52:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Analytics(props: {
|
|
|
|
startDate: number
|
2022-03-03 20:59:12 +00:00
|
|
|
dailyActiveUsers: number[]
|
2022-03-21 22:42:06 +00:00
|
|
|
weeklyActiveUsers: number[]
|
|
|
|
monthlyActiveUsers: number[]
|
2022-03-03 01:52:41 +00:00
|
|
|
dailyBetCounts: number[]
|
|
|
|
dailyContractCounts: number[]
|
2022-03-03 20:59:12 +00:00
|
|
|
dailyCommentCounts: number[]
|
2022-05-19 21:13:30 +00:00
|
|
|
dailySignups: number[]
|
2022-03-22 21:24:26 +00:00
|
|
|
weekOnWeekRetention: number[]
|
2022-04-19 06:57:27 +00:00
|
|
|
monthlyRetention: number[]
|
2022-04-19 06:47:58 +00:00
|
|
|
weeklyActivationRate: number[]
|
2022-06-13 20:51:15 +00:00
|
|
|
topTenthActions: {
|
|
|
|
daily: number[]
|
|
|
|
weekly: number[]
|
|
|
|
monthly: number[]
|
|
|
|
}
|
2022-06-11 04:44:19 +00:00
|
|
|
manaBet: {
|
|
|
|
daily: number[]
|
|
|
|
weekly: number[]
|
|
|
|
monthly: number[]
|
|
|
|
}
|
2022-03-03 01:52:41 +00:00
|
|
|
}) {
|
2022-03-09 02:43:30 +00:00
|
|
|
props = usePropz(props, getStaticPropz) ?? {
|
|
|
|
startDate: 0,
|
|
|
|
dailyActiveUsers: [],
|
2022-03-21 22:42:06 +00:00
|
|
|
weeklyActiveUsers: [],
|
|
|
|
monthlyActiveUsers: [],
|
2022-03-09 02:43:30 +00:00
|
|
|
dailyBetCounts: [],
|
|
|
|
dailyContractCounts: [],
|
|
|
|
dailyCommentCounts: [],
|
2022-05-19 21:13:30 +00:00
|
|
|
dailySignups: [],
|
2022-03-22 21:24:26 +00:00
|
|
|
weekOnWeekRetention: [],
|
2022-04-19 06:57:27 +00:00
|
|
|
monthlyRetention: [],
|
2022-04-19 06:47:58 +00:00
|
|
|
weeklyActivationRate: [],
|
2022-06-13 20:51:15 +00:00
|
|
|
topTenthActions: {
|
|
|
|
daily: [],
|
|
|
|
weekly: [],
|
|
|
|
monthly: [],
|
|
|
|
},
|
2022-06-11 04:44:19 +00:00
|
|
|
manaBet: {
|
|
|
|
daily: [],
|
|
|
|
weekly: [],
|
|
|
|
monthly: [],
|
|
|
|
},
|
2022-03-09 02:43:30 +00:00
|
|
|
}
|
2022-01-17 18:34:28 +00:00
|
|
|
return (
|
|
|
|
<Page>
|
2022-05-31 15:32:11 +00:00
|
|
|
<Tabs
|
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
title: 'Activity',
|
|
|
|
content: <CustomAnalytics {...props} />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Market Stats',
|
|
|
|
content: <WasabiCharts />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Google Analytics',
|
|
|
|
content: <FirebaseAnalytics />,
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
2022-01-17 18:34:28 +00:00
|
|
|
</Page>
|
|
|
|
)
|
|
|
|
}
|
2022-03-03 01:52:41 +00:00
|
|
|
|
2022-03-20 22:21:28 +00:00
|
|
|
export function CustomAnalytics(props: {
|
2022-03-03 01:52:41 +00:00
|
|
|
startDate: number
|
2022-03-03 20:59:12 +00:00
|
|
|
dailyActiveUsers: number[]
|
2022-03-21 22:42:06 +00:00
|
|
|
weeklyActiveUsers: number[]
|
|
|
|
monthlyActiveUsers: number[]
|
2022-03-03 01:52:41 +00:00
|
|
|
dailyBetCounts: number[]
|
|
|
|
dailyContractCounts: number[]
|
2022-03-03 20:59:12 +00:00
|
|
|
dailyCommentCounts: number[]
|
2022-05-19 21:13:30 +00:00
|
|
|
dailySignups: number[]
|
2022-03-22 21:24:26 +00:00
|
|
|
weekOnWeekRetention: number[]
|
2022-04-19 06:57:27 +00:00
|
|
|
monthlyRetention: number[]
|
2022-04-19 06:47:58 +00:00
|
|
|
weeklyActivationRate: number[]
|
2022-06-13 20:51:15 +00:00
|
|
|
topTenthActions: {
|
|
|
|
daily: number[]
|
|
|
|
weekly: number[]
|
|
|
|
monthly: number[]
|
|
|
|
}
|
2022-06-11 04:44:19 +00:00
|
|
|
manaBet: {
|
|
|
|
daily: number[]
|
|
|
|
weekly: number[]
|
|
|
|
monthly: number[]
|
|
|
|
}
|
2022-03-03 01:52:41 +00:00
|
|
|
}) {
|
2022-03-03 20:59:12 +00:00
|
|
|
const {
|
|
|
|
dailyActiveUsers,
|
|
|
|
dailyBetCounts,
|
|
|
|
dailyContractCounts,
|
|
|
|
dailyCommentCounts,
|
2022-05-19 21:13:30 +00:00
|
|
|
dailySignups,
|
2022-03-21 22:42:06 +00:00
|
|
|
weeklyActiveUsers,
|
|
|
|
monthlyActiveUsers,
|
2022-03-22 21:24:26 +00:00
|
|
|
weekOnWeekRetention,
|
2022-04-19 06:57:27 +00:00
|
|
|
monthlyRetention,
|
2022-04-19 06:47:58 +00:00
|
|
|
weeklyActivationRate,
|
2022-06-13 20:51:15 +00:00
|
|
|
topTenthActions,
|
2022-06-11 04:44:19 +00:00
|
|
|
manaBet,
|
2022-03-03 20:59:12 +00:00
|
|
|
} = props
|
2022-04-16 01:56:07 +00:00
|
|
|
|
2022-05-19 20:14:13 +00:00
|
|
|
const startDate = dayjs(props.startDate).add(12, 'hours').valueOf()
|
|
|
|
|
2022-04-16 01:56:07 +00:00
|
|
|
const dailyDividedByWeekly = dailyActiveUsers
|
|
|
|
.map((dailyActive, i) =>
|
|
|
|
Math.round((100 * dailyActive) / weeklyActiveUsers[i])
|
|
|
|
)
|
|
|
|
.slice(7)
|
|
|
|
|
|
|
|
const dailyDividedByMonthly = dailyActiveUsers
|
|
|
|
.map((dailyActive, i) =>
|
|
|
|
Math.round((100 * dailyActive) / monthlyActiveUsers[i])
|
|
|
|
)
|
|
|
|
.slice(7)
|
|
|
|
|
|
|
|
const weeklyDividedByMonthly = weeklyActiveUsers
|
|
|
|
.map((weeklyActive, i) =>
|
|
|
|
Math.round((100 * weeklyActive) / monthlyActiveUsers[i])
|
|
|
|
)
|
|
|
|
.slice(7)
|
|
|
|
|
|
|
|
const oneWeekLaterDate = startDate + 7 * 24 * 60 * 60 * 1000
|
|
|
|
|
2022-03-03 01:52:41 +00:00
|
|
|
return (
|
2022-03-23 02:05:28 +00:00
|
|
|
<Col className="px-2 sm:px-0">
|
2022-03-22 22:53:06 +00:00
|
|
|
<Title text="Active users" />
|
|
|
|
<p className="text-gray-500">
|
|
|
|
An active user is a user who has traded in, commented on, or created a
|
|
|
|
market.
|
|
|
|
</p>
|
|
|
|
<Spacer h={4} />
|
2022-03-21 22:42:06 +00:00
|
|
|
|
2022-03-22 22:53:06 +00:00
|
|
|
<Tabs
|
|
|
|
defaultIndex={1}
|
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
title: 'Daily',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={dailyActiveUsers}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Weekly',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={weeklyActiveUsers}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Monthly',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={monthlyActiveUsers}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
2022-03-21 22:42:06 +00:00
|
|
|
/>
|
2022-03-22 22:53:06 +00:00
|
|
|
<Spacer h={8} />
|
2022-03-03 20:59:12 +00:00
|
|
|
|
2022-03-22 22:53:06 +00:00
|
|
|
<Title text="Daily activity" />
|
|
|
|
<Tabs
|
|
|
|
defaultIndex={0}
|
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
title: 'Trades',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={dailyBetCounts}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Markets created',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={dailyContractCounts}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Comments',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={dailyCommentCounts}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
2022-05-19 21:13:30 +00:00
|
|
|
{
|
|
|
|
title: 'Signups',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={dailySignups}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
2022-03-22 22:53:06 +00:00
|
|
|
]}
|
2022-03-03 20:59:12 +00:00
|
|
|
/>
|
2022-04-16 01:56:07 +00:00
|
|
|
|
|
|
|
<Spacer h={8} />
|
|
|
|
|
2022-04-19 06:57:27 +00:00
|
|
|
<Title text="Retention" />
|
2022-04-16 01:56:07 +00:00
|
|
|
<p className="text-gray-500">
|
2022-04-19 06:57:27 +00:00
|
|
|
What fraction of active users are still active after the given time
|
|
|
|
period?
|
2022-04-16 01:56:07 +00:00
|
|
|
</p>
|
2022-04-19 06:57:27 +00:00
|
|
|
<Tabs
|
|
|
|
defaultIndex={0}
|
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
title: 'Weekly',
|
|
|
|
content: (
|
|
|
|
<DailyPercentChart
|
|
|
|
dailyPercent={weekOnWeekRetention.slice(7)}
|
|
|
|
startDate={oneWeekLaterDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Monthly',
|
|
|
|
content: (
|
|
|
|
<DailyPercentChart
|
|
|
|
dailyPercent={monthlyRetention.slice(7)}
|
|
|
|
startDate={oneWeekLaterDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
2022-04-16 01:56:07 +00:00
|
|
|
/>
|
|
|
|
<Spacer h={8} />
|
|
|
|
|
2022-04-19 06:47:58 +00:00
|
|
|
<Title text="Weekly activation rate" />
|
|
|
|
<p className="text-gray-500">
|
|
|
|
Out of all new users this week, how many placed at least one bet?
|
|
|
|
</p>
|
|
|
|
<DailyPercentChart
|
|
|
|
dailyPercent={weeklyActivationRate.slice(7)}
|
|
|
|
startDate={oneWeekLaterDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
<Spacer h={8} />
|
|
|
|
|
2022-04-16 01:56:07 +00:00
|
|
|
<Title text="Ratio of Active Users" />
|
|
|
|
<Tabs
|
2022-05-02 22:18:40 +00:00
|
|
|
defaultIndex={1}
|
2022-04-16 01:56:07 +00:00
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
title: 'Daily / Weekly',
|
|
|
|
content: (
|
|
|
|
<DailyPercentChart
|
|
|
|
dailyPercent={dailyDividedByWeekly}
|
|
|
|
startDate={oneWeekLaterDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Daily / Monthly',
|
|
|
|
content: (
|
|
|
|
<DailyPercentChart
|
|
|
|
dailyPercent={dailyDividedByMonthly}
|
|
|
|
startDate={oneWeekLaterDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Weekly / Monthly',
|
|
|
|
content: (
|
|
|
|
<DailyPercentChart
|
|
|
|
dailyPercent={weeklyDividedByMonthly}
|
|
|
|
startDate={oneWeekLaterDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
2022-03-22 22:53:06 +00:00
|
|
|
<Spacer h={8} />
|
2022-06-11 04:22:47 +00:00
|
|
|
|
2022-06-13 20:51:15 +00:00
|
|
|
<Title text="Action count of top tenth" />
|
2022-06-11 04:22:47 +00:00
|
|
|
<p className="text-gray-500">
|
2022-06-13 20:51:15 +00:00
|
|
|
Number of actions (bets, comments, markets created) taken by the tenth
|
|
|
|
percentile of top users.
|
2022-06-11 04:22:47 +00:00
|
|
|
</p>
|
|
|
|
<Tabs
|
|
|
|
defaultIndex={1}
|
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
title: 'Daily',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
2022-06-13 20:51:15 +00:00
|
|
|
dailyCounts={topTenthActions.daily}
|
2022-06-11 04:22:47 +00:00
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Weekly',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
2022-06-13 20:51:15 +00:00
|
|
|
dailyCounts={topTenthActions.weekly}
|
2022-06-11 04:22:47 +00:00
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Monthly',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
2022-06-13 20:51:15 +00:00
|
|
|
dailyCounts={topTenthActions.monthly}
|
2022-06-11 04:22:47 +00:00
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
2022-06-11 04:44:19 +00:00
|
|
|
|
|
|
|
<Title text="Total mana bet" />
|
|
|
|
<p className="text-gray-500">
|
|
|
|
Sum of bet amounts. (Divided by 100 to be more readable.)
|
|
|
|
</p>
|
|
|
|
<Tabs
|
|
|
|
defaultIndex={1}
|
|
|
|
tabs={[
|
|
|
|
{
|
|
|
|
title: 'Daily',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={manaBet.daily}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Weekly',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={manaBet.weekly}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Monthly',
|
|
|
|
content: (
|
|
|
|
<DailyCountChart
|
|
|
|
dailyCounts={manaBet.monthly}
|
|
|
|
startDate={startDate}
|
|
|
|
small
|
|
|
|
/>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
2022-03-22 22:53:06 +00:00
|
|
|
</Col>
|
|
|
|
)
|
|
|
|
}
|
2022-03-03 01:52:41 +00:00
|
|
|
|
2022-03-20 22:21:28 +00:00
|
|
|
export function FirebaseAnalytics() {
|
2022-03-03 01:52:41 +00:00
|
|
|
// Edit dashboard at https://datastudio.google.com/u/0/reporting/faeaf3a4-c8da-4275-b157-98dad017d305/page/Gg3/edit
|
2022-03-22 22:53:06 +00:00
|
|
|
|
2022-03-03 01:52:41 +00:00
|
|
|
return (
|
2022-03-22 22:53:06 +00:00
|
|
|
<>
|
|
|
|
<p className="text-gray-500">
|
|
|
|
Less accurate; includes all viewers (not just signed-in users).
|
|
|
|
</p>
|
|
|
|
<Spacer h={4} />
|
|
|
|
<iframe
|
|
|
|
className="w-full"
|
|
|
|
height={2200}
|
|
|
|
src="https://datastudio.google.com/embed/reporting/faeaf3a4-c8da-4275-b157-98dad017d305/page/Gg3"
|
|
|
|
frameBorder="0"
|
|
|
|
style={{ border: 0 }}
|
|
|
|
allowFullScreen
|
|
|
|
/>
|
|
|
|
</>
|
2022-03-03 01:52:41 +00:00
|
|
|
)
|
|
|
|
}
|
2022-05-31 15:32:11 +00:00
|
|
|
|
|
|
|
export function WasabiCharts() {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<p className="text-gray-500">
|
|
|
|
Courtesy of <Linkify text="@wasabipesto" />; originally found{' '}
|
|
|
|
<SiteLink
|
|
|
|
className="font-bold"
|
|
|
|
href="https://wasabipesto.com/jupyter/manifold/"
|
|
|
|
>
|
|
|
|
here.
|
|
|
|
</SiteLink>
|
|
|
|
</p>
|
|
|
|
<Spacer h={4} />
|
|
|
|
<iframe
|
|
|
|
className="w-full"
|
2022-06-10 01:35:38 +00:00
|
|
|
height={21000}
|
2022-05-31 15:32:11 +00:00
|
|
|
src="https://wasabipesto.com/jupyter/manifold/"
|
|
|
|
frameBorder="0"
|
|
|
|
style={{ border: 0 }}
|
|
|
|
allowFullScreen
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|