Skip to content

feat: Add anonymous analytics via GoatCounter - #214

Merged
pranshuparmar merged 1 commit into
mainfrom
claude/playground-analytics
Jul 23, 2026
Merged

pranshuparmar merged 1 commit into
mainfrom
claude/playground-analytics

Conversation

@pranshuparmar

Copy link
Copy Markdown
Owner

Description

This PR adds optional, privacy-respecting analytics to the playground using GoatCounter. The implementation tracks key user interactions (tutorial started/completed, tasks resolved, TUI opened, install command copied, scenario switches, and outbound clicks) while maintaining the principle that the playground never depends on analytics.

The analytics.js module is a thin wrapper that silently no-ops when the GoatCounter script is blocked by adblockers, offline, or unavailable. Events are deduplicated per page load and queued until the counter script loads, with automatic retry logic. The dashboard is public at https://witr.goatcounter.com.

A footer note discloses the analytics to visitors, emphasizing that nothing is stored in their browser.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Changes

  • docs/js/analytics.js (new): Thin wrapper around GoatCounter with queue/retry logic and deduplication
  • docs/js/app.js: Integrated track() calls at 8 key user interaction points
  • docs/index.html: Added GoatCounter script tag and footer disclosure note
  • docs/css/styles.css: Styled the stats disclosure footer
  • docs/README.md: Documented the analytics implementation and privacy approach

Checklist

  • I have performed a self-review of my own code
  • I have added helpful comments where needed
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Test Plan

The analytics module is defensive by design—all calls are silent no-ops if GoatCounter is unavailable. Manual verification:

  1. Open the playground and verify the footer disclosure appears
  2. Open DevTools and confirm no errors occur (analytics failures are caught)
  3. Verify key interactions trigger tracking (tutorial start, task completion, TUI open, etc.)
  4. Test with adblocker enabled to confirm the playground functions normally
  5. Check the public dashboard at https://witr.goatcounter.com to see aggregated stats

https://claude.ai/code/session_01K4HgTJBEvAQBjstvdUcrYQ

One async script tag plus a thin wrapper (js/analytics.js) that queues
events until count.js arrives and silently no-ops when it's blocked or
down — the playground never depends on it. Counts pageviews and a small
set of per-visit events: tutorial started/completed per scenario, tasks
resolved, side quests tried, TUI opened, install modal/copy, scenario
switches, and outbound repo clicks. A footer note discloses the stats
and links to the public dashboard; docs/README.md documents the setup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K4HgTJBEvAQBjstvdUcrYQ
@pranshuparmar pranshuparmar changed the title Add anonymous analytics via GoatCounter feat: Add anonymous analytics via GoatCounter Jul 23, 2026
@pranshuparmar
pranshuparmar merged commit 63f557c into main Jul 23, 2026
33 of 34 checks passed
@pranshuparmar
pranshuparmar deleted the claude/playground-analytics branch July 24, 2026 09:36
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.

2 participants