Skip to content

feat(analytics): add posthog as an analytics provider#2414

Open
creeperkatze wants to merge 6 commits into
wxt-dev:mainfrom
creeperkatze:add-posthog-analytics-provider
Open

feat(analytics): add posthog as an analytics provider#2414
creeperkatze wants to merge 6 commits into
wxt-dev:mainfrom
creeperkatze:add-posthog-analytics-provider

Conversation

@creeperkatze

@creeperkatze creeperkatze commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds a PostHog provider to the analytics package. Uses PostHog's REST capture API (/i/v0/e/) directly via fetch instead of importing posthog-js, keeping it MV3 compliant with no remote code. Supports identify, page, and track events.

Also adds missing debug logs to the Google Analytics 4 provider and removes unnecessary optional chaining on config.

Manual Testing

  1. Install @wxt-dev/analytics and add the posthog provider to app.config.ts:
    import { posthog } from '@wxt-dev/analytics/providers/posthog';
    
    posthog({ apiKey: 'phc_...', apiHost: 'https://us.i.posthog.com' })
  2. Enable analytics via the enabled config or analytics.setEnabled(true).
  3. Trigger events (e.g. via analytics.autoTrack(document)).
  4. Confirm events appear in PostHog's Activity > Live Events dashboard.

@creeperkatze creeperkatze requested a review from aklinker1 as a code owner June 13, 2026 10:21
@netlify

netlify Bot commented Jun 13, 2026

Copy link
Copy Markdown

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 08ec7d8
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6a2d2fdc03ed130009cb885a
😎 Deploy Preview https://deploy-preview-2414--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the pkg/analytics Includes changes to the `packages/analytics` directory label Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/analytics Includes changes to the `packages/analytics` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant