Skip to content

[codex] Add competition analytics tracking#76

Merged
coder13 merged 4 commits into
betafrom
codex/add-competition-analytics
May 30, 2026
Merged

[codex] Add competition analytics tracking#76
coder13 merged 4 commits into
betafrom
codex/add-competition-analytics

Conversation

@coder13
Copy link
Copy Markdown
Owner

@coder13 coder13 commented May 30, 2026

What changed

Adds Umami analytics support alongside the existing GA setup, including script loading from Vite env vars and shared event metadata for app, environment, version, auth status, and user ID.

Competition pages now emit competition/page view events, track visible active time every 60 seconds, and record live activity creation from the remote controls page.

Umami events include an environment label that distinguishes Netlify production traffic from beta traffic: main builds report production, beta builds report beta, and VITE_APP_ENV can override this when needed.

Validation

  • yarn test src/lib/analytics.test.ts src/hooks/usePageActivityTracking/usePageActivityTracking.test.ts --runInBand
  • yarn check:type
  • yarn lint (passes with 4 existing warnings in unrelated files)
  • pre-push checks: yarn lint, yarn check:type, yarn test (30 suites / 124 tests passed)

@netlify
Copy link
Copy Markdown

netlify Bot commented May 30, 2026

Deploy Preview for competition-groups ready!

Name Link
🔨 Latest commit c393166
🔍 Latest deploy log https://app.netlify.com/projects/competition-groups/deploys/6a1a4059cb6e530007130c1b
😎 Deploy Preview https://deploy-preview-76--competition-groups.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 61
Accessibility: 84
Best Practices: 100
SEO: 96
PWA: 90
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

import { useAuth } from '@/providers/AuthProvider';
import { usePageActivityTracking } from '../usePageActivityTracking';

const competitionPageName = (pathname: string, competitionId: string) => {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the full extent of all of the pages....Unless it is?

I want to report every single page

return relativePath.replace(/^\//, '').replace(/\//g, '_') || 'competition';
};

const pageViewEventName = (page: string) => {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I want to report every single page

Load configured Umami analytics, attach competition page events, and track active page time.

Include environment declarations and focused coverage for analytics helpers and activity timers.
@coder13 coder13 force-pushed the codex/add-competition-analytics branch from f6df5e0 to 475f174 Compare May 30, 2026 01:21
@coder13 coder13 merged commit c393166 into beta May 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant