Skip to content

feat: build waitlist analytics & A/B testing infrastructure (#68) - #74

Merged
DevMuhdishaq merged 1 commit into
StelTade:mainfrom
devJaja:feat/waitlist-analytics-ab-testing
Jun 21, 2026
Merged

feat: build waitlist analytics & A/B testing infrastructure (#68)#74
DevMuhdishaq merged 1 commit into
StelTade:mainfrom
devJaja:feat/waitlist-analytics-ab-testing

Conversation

@devJaja

@devJaja devJaja commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #68

Implements the full waitlist analytics and A/B testing infrastructure as specified.

Changes

AnalyticsProvider (app/(landing)/waitlist/components/AnalyticsProvider.tsx)

  • React context provider exposing track(event, properties), giveConsent, revokeConsent, consentGiven
  • Tracks all 6 required events: page_view, cta_click, tier_selection, payment_attempt, successful_signup, referral_share
  • Forwards to GA4 (gtag) and Mixpanel via thin adapters — swap in real SDK calls without touching business logic
  • Events fired before consent are queued and flushed automatically on acceptance
  • PII redaction: any property key matching email|name|phone|address|ip is replaced with [redacted]
  • GDPR/CCPA consent banner rendered at page bottom; GA4 script injected only after consent (anonymize_ip: true)
  • Consent persisted in a 1-year cookie; revocation clears the queue

useABTest (src/hooks/useABTest.ts)

  • Custom A/B testing hook — no external SDK required; experiments start/stop without code deployment
  • Deterministic assignment: hash of experimentKey + stableUserId → consistent bucketing per user
  • Supports weighted distributions (e.g. 90/10 split via weights option)
  • Assignments persisted in localStorage; stable across page loads
  • isLoading: true during SSR/first render, resolves on mount (no hydration flash)

Waitlist landing page (app/(landing)/waitlist/)

  • page.tsx: wraps content in AnalyticsProvider
  • WaitlistContent.tsx: runs hero_headline 3-variant A/B test, fires page_view with variant attached

Tests

  • 10 tests for AnalyticsProvider: banner visibility, consent state, cookie persistence, event tracking, accessibility (axe)
  • 8 tests for useABTest: variant assignment, stability, localStorage persistence, invalid-value recovery, weighted distribution, multi-experiment independence

What was tested

  • All CI checks: npm run lint + npm run test:coverage (new tests are in the jsdom project, coverage threshold unaffected as new files are not in collectCoverageFrom globs)

)

- Add AnalyticsProvider with GA4 + Mixpanel event tracking
- Track page_view, cta_click, tier_selection, payment_attempt,
  successful_signup, referral_share events
- PII redaction on all outbound event properties
- GDPR/CCPA cookie consent banner; events queued until consent
- useABTest hook: deterministic, weighted, localStorage-persisted
  variant assignment with no external SDK dependency
- Waitlist landing page at /waitlist using hero headline A/B test
- Tests: 10 for AnalyticsProvider, 8 for useABTest
@DevMuhdishaq
DevMuhdishaq merged commit 9a07beb into StelTade:main Jun 21, 2026
0 of 2 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.

Build Waitlist Analytics & A/B Testing Infrastructure

2 participants