feat: add PostHog analytics to the extension#5
Open
sonpiaz wants to merge 1 commit into
Open
Conversation
Instrument the Echoly extension with the same PostHog project the website uses (echolyhq.com), so we can see real usage — most-Started voices, popular target languages, realtime vs standard split, and open→dub funnel. - analytics.js: tiny MV3-safe PostHog client. MV3 CSP forbids the posthog-js CDN and there is no bundler, so it POSTs straight to the capture endpoint from the service worker. Anonymous: random distinct_id in storage, no email, no Kyma key, no provider/routing detail; person profiles disabled. - background.js: emit extension_installed/updated, dub_started, dub_failed, dub_stopped (with duration). All session events route through the SW. - popup.js: emit popup_opened via a TRACK passthrough message. - manifest.json: add us.i.posthog.com host permission; bump 0.6.3 -> 0.6.4. Verified: capture endpoint returns HTTP 200; JS/JSON syntax checks pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Cắm PostHog vào extension, dùng chung project với website (echolyhq.com) để có số liệu sử dụng thật.
Why
Trả lời được các câu cụ thể: giọng nào được Start nhiều nhất (mục tiêu rút gọn top 3 voices), ngôn ngữ đích phổ biến, tỉ lệ realtime vs standard, và funnel mở popup → dub.
Events
extension_installed/extension_updatedpopup_openeddub_startedvoice,target_language,tier,api_modedub_failederrordub_stoppedduration_seconds,reasonDesign notes
script-src 'self') cấm nạp posthog-js từ CDN + không có bundler →analytics.jslà client mini POST thẳng vào capture endpoint từ service worker.distinct_idtrong storage), không gửi email / Kyma key / tên provider/routing; tắt person profiles.TRACKmessage) để né CSP/CORS ở content script.us.i.posthog.com; bump0.6.3 → 0.6.4.Verification
node --check(analytics/background/popup) + JSON validate đều pass.🤖 Generated with Claude Code