Skip to content

Add meaningful product usage analytics - #112

Merged
a-baran-orhan merged 2 commits into
mainfrom
codex/product-usage-analytics
Jul 27, 2026
Merged

Add meaningful product usage analytics#112
a-baran-orhan merged 2 commits into
mainfrom
codex/product-usage-analytics

Conversation

@a-baran-orhan

Copy link
Copy Markdown
Member

Summary

Adds a small, provider-neutral product analytics layer and wires it to real product outcomes so Vercel pageviews can be separated from meaningful Posecode usage. No new analytics vendor is introduced.

Event dictionary

Event Trigger Properties
preset_opened Initial bundled preset load or library selection source, preset_id
editor_changed First real CodeMirror user edit in the page session document_kind
render_succeeded Successful viewer.load() for a new meaningful revision trigger, document_kind
share_created Share URL successfully written to clipboard share_kind
embed_docs_clicked Embed docs CTA clicked on /for-products location
install_command_copied npm/npx command successfully written to clipboard command, location

Preset sources distinguish library, direct_url, shared_link, and landing_cta. Editor changes are deduplicated to the first user edit per page session. Render events are revision-deduplicated and never fire from the animation loop.

Privacy and reliability

  • Never sends Posecode source, prompts, personal data, share tokens, query strings, referrers, or sensitive URLs.
  • Uses only closed enums plus the bounded public preset ID.
  • Keeps every event at or below Vercel Pro's two-property limit.
  • Catches provider/ad-block/network failures so analytics cannot break product behavior.
  • Sends share and command-copy events only after clipboard success.
  • The pre-existing fix/reduce-contact-warnings worktree changes are not included in this branch or PR.

Provider and manual production setup

Vercel Hobby includes pageviews but does not support custom events; custom events require Pro or Enterprise. Pageviews remain enabled as before. On an eligible production project:

  1. Enable Web Analytics in Vercel.
  2. Set VITE_PRODUCT_ANALYTICS_PROVIDER=vercel for Production.
  3. Redeploy.
  4. Confirm events under Project → Analytics → Events.

Full details are in docs/product-analytics.md.

Validation

  • npm test — 38 files, 406 tests passed
  • npm run typecheck — passed
  • npm run build — passed
  • git diff --check — passed

The production build retains the existing renderer chunk-size warning; no new build failure was introduced.

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
posecode Ready Ready Preview, Comment Jul 27, 2026 10:18pm

@a-baran-orhan
a-baran-orhan merged commit 3a72ea4 into main Jul 27, 2026
3 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