Skip to content

feat(analytics): internal traffic, debug mode and user properties - #62

Merged
raferdev merged 2 commits into
mainfrom
feat/analytics-insights
Sep 29, 2026
Merged

raferdev merged 2 commits into
mainfrom
feat/analytics-insights

Conversation

@raferdev

Copy link
Copy Markdown
Owner

Summary

  • Internal traffic: visiting /?internal=1 once tags that browser, and its hits carry traffic_type=internal, so GA's Internal Traffic filter can exclude your own visits on any network. /?internal=0 undoes it.
  • DebugView: /?ga_debug=1 adds debug_mode for that tab only (sessionStorage). The key is left out entirely when off, because GA treats any debug_mode value as on.
  • Both switches work before consent and are removed from the address bar right away, so a shared link never tags someone else.
  • User properties: site_language (en / pt-BR) and color_scheme (light / dark), updated when the theme or the system scheme changes.
  • Privacy policy (EN/PT) lists the two new data points, with the date bumped; README documents the switches.

Verification

  • 14 new analytics tests; the full suite (208 tests) passes against the nginx test container.
  • A build with the production tag, loading the real gtag.js with hits blocked before sending, showed:
    • plain visit: en=page_view up.site_language=en up.color_scheme=light, no internal or debug markers;
    • /pt?internal=1 in dark mode: tt=internal up.site_language=pt-BR up.color_scheme=dark;
    • /?ga_debug=1: ep.debug_mode=true.

After merging (in GA)

  • Register site_language and color_scheme as User-scoped custom dimensions.
  • Visit https://rafer.dev/?internal=1 from each of your browsers, then activate the Internal Traffic data filter.

🤖 Generated with Claude Code

- /?internal=1 tags the browser as internal traffic (traffic_type) so the
  GA Internal Traffic filter can exclude the owner's visits; /?internal=0
  clears it. Stored in localStorage and works on any network
- /?ga_debug=1 sends the tab's visit to DebugView (debug_mode); kept in
  sessionStorage so it ends with the tab. debug_mode is omitted entirely
  when off, since GA treats any value as on
- both switches are read on load even before consent and removed from the
  address bar so shared links never carry them
- site_language and color_scheme user properties, set before config and
  updated when the theme or the system scheme changes
- privacy policy (EN/PT) lists the two new data points; README documents
  the switches
- analytics spec covers properties, flags, persistence and URL cleanup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c13ebd3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
landing-page Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@raferdev
raferdev merged commit 9577198 into main Sep 29, 2026
8 checks passed
@raferdev
raferdev deleted the feat/analytics-insights branch September 29, 2026 18:48
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