feat: privacy-respecting analytics
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
2170e9275c
commit
e10c1dc8aa
@@ -15,6 +15,7 @@ import { settleBets, lockBets } from './betting.js'
|
||||
import { publishFightResult } from './nostr-publish.js'
|
||||
import { getCurrentSeason } from './seasons.js'
|
||||
import { onFightFinished as onTournamentFightFinished } from './tournaments.js'
|
||||
import { trackFightCompleted, trackBotActive, trackMetric } from './analytics.js'
|
||||
|
||||
interface BotRecord {
|
||||
id: string
|
||||
@@ -514,6 +515,18 @@ async function executeFightRounds(fightId: string, botA: BotRecord, botB: BotRec
|
||||
|
||||
finalize()
|
||||
|
||||
// Track aggregate analytics (no PII)
|
||||
trackBotActive(botA.id)
|
||||
trackBotActive(botB.id)
|
||||
trackFightCompleted({
|
||||
satsWagered: mode === 'ranked' ? ENTRY_FEE_SATS * 2 : 0,
|
||||
durationRounds: lastRound,
|
||||
mode,
|
||||
})
|
||||
for (const ct of usedTypes) {
|
||||
trackMetric(`challenge_${ct}`)
|
||||
}
|
||||
|
||||
// Advance tournament bracket if this was a tournament match
|
||||
try { onTournamentFightFinished(fightId, winnerId ?? null) } catch { /* not a tournament fight */ }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user