feat: add Mixpanel analytics to script registry#633
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
📝 WalkthroughWalkthroughAdds Mixpanel analytics integration to the script registry. Changes include: a new Partytown forward mapping for Mixpanel APIs, JSON registry types entries for Mixpanel options and API, a registry entry for the Mixpanel provider (CDN src, label, category, logo, and composable import), a runtime module that registers the Mixpanel script, exposes and polyfills Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/registry.ts (1)
125-134: Consider addingproxyfield for first-party mode support.The Mixpanel registry entry is missing the
proxyfield that other analytics integrations (Plausible, Fathom, Segment, PostHog) include. Without it, Mixpanel won't benefit from first-party proxy mode, meaning:
- User IPs will be visible to Mixpanel
- Requests may be blocked by ad blockers
- Third-party cookies apply
If first-party support for Mixpanel is planned for a future iteration, this is fine. Otherwise, consider adding proxy configuration to match other analytics integrations.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/registry.ts` around lines 125 - 134, The Mixpanel registry entry (the object with label 'Mixpanel' and import name 'useScriptMixpanelAnalytics') lacks the same proxy configuration other analytics entries use; add a proxy field to that object mirroring the structure used by Plausible/Fathom/Segment/PostHog (e.g., a proxy object with the same keys those entries use such as endpoint/path and any env key names) so Mixpanel can operate in first‑party/proxy mode and avoid third‑party tracking issues.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/registry.ts`:
- Around line 125-134: The Mixpanel registry entry (the object with label
'Mixpanel' and import name 'useScriptMixpanelAnalytics') lacks the same proxy
configuration other analytics entries use; add a proxy field to that object
mirroring the structure used by Plausible/Fathom/Segment/PostHog (e.g., a proxy
object with the same keys those entries use such as endpoint/path and any env
key names) so Mixpanel can operate in first‑party/proxy mode and avoid
third‑party tracking issues.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4b411c0a-8795-4d84-b3b4-cca87ff0bca5
📒 Files selected for processing (5)
src/module.tssrc/registry-types.jsonsrc/registry.tssrc/runtime/registry/mixpanel-analytics.tssrc/runtime/registry/schemas.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs/content/scripts/mixpanel.md (1)
26-40: Rename this section or add a real composable example.“Composable Usage” currently shows
nuxt.configregistry setup, not a composable invocation. That makes the page harder to scan because the first actualuseScriptMixpanelAnalytics()usage only appears later on Line 46. Consider renaming this to “Nuxt Config Usage” or adding a top-level composable example here instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/content/scripts/mixpanel.md` around lines 26 - 40, The "Composable Usage" heading is misleading because it shows nuxt.config registry setup instead of a composable call; rename the heading to "Nuxt Config Usage" or replace/add content showing the composable invocation useScriptMixpanelAnalytics() at the top of the section so readers see the actual composable usage immediately (keep the existing nuxt.config example as a separate subsection or follow the composable example with it).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs/content/scripts/mixpanel.md`:
- Around line 26-40: The "Composable Usage" heading is misleading because it
shows nuxt.config registry setup instead of a composable call; rename the
heading to "Nuxt Config Usage" or replace/add content showing the composable
invocation useScriptMixpanelAnalytics() at the top of the section so readers see
the actual composable usage immediately (keep the existing nuxt.config example
as a separate subsection or follow the composable example with it).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: be25396f-7034-4d5c-a356-6dc95814839b
📒 Files selected for processing (1)
docs/content/scripts/mixpanel.md
🔗 Linked issue
Resolves #604
❓ Type of change
📚 Description
Adds Mixpanel as a new registry script with
useScriptMixpanelAnalytics()composable. Follows the existing analytics script pattern (Segment, PostHog) with method queueing before load,mixpanel.init(token)on client init, and Partytown forward support. Includes documentation page.