Skip to content

feat(docs): upgrade vue-privacy with GA4 tracking + dependency updates#284

Merged
polaz merged 4 commits intomainfrom
feat/#282-featdocs-upgrade-vue-privacy-with-ga4-tracking--de
Feb 4, 2026
Merged

feat(docs): upgrade vue-privacy with GA4 tracking + dependency updates#284
polaz merged 4 commits intomainfrom
feat/#282-featdocs-upgrade-vue-privacy-with-ga4-tracking--de

Conversation

@polaz
Copy link
Copy Markdown
Member

@polaz polaz commented Feb 4, 2026

Summary

  • Add GA4 event tracking for search, downloads, and outbound links in docs
  • Upgrade vue-privacy and update other dependencies

Changes

GA4 Event Tracking

  • Search tracking: Debounced (1s) tracking of VitePress local search queries → GA4 search event with search_term parameter
  • File download tracking: Track .mcpb bundle downloads → GA4 file_download event with file_name, file_extension, link_url
  • Outbound link tracking: Track external link clicks → GA4 click event with link_url, link_domain, outbound: true

New Files

  • docs/.vitepress/theme/composables/useGA4Tracking.ts - Consent-aware GA4 tracking composable
  • docs/.vitepress/theme/components/GA4EventTracker.vue - Invisible component that hooks into DOM events

Dependencies Updated

Package From To
@structured-world/vue-privacy ^1.2.3 ^1.6.1
@modelcontextprotocol/sdk ^1.25.3 ^1.26.0
picomatch ^4.0.0 ^4.0.3
undici ^7.19.2 ^7.20.0
@cloudflare/workers-types ^4.20260131.0 ^4.20260203.0
@types/node ^24.10.9 ^24.10.10

Privacy & Consent

All tracking respects user consent - events are silently dropped when analytics consent is denied. Uses the useConsent() composable from vue-privacy to check consent status before sending any events.

Test Plan

  • yarn lint passes
  • yarn test (unit tests) passes
  • yarn test:all (unit + integration) passes
  • yarn build completes
  • VitePress dev server starts without errors
  • Events visible in GA4 Realtime report (manual verification after deploy)

Closes #282

…d links

- Add GA4EventTracker Vue component for consent-aware event tracking
- Track VitePress search queries (debounced) as GA4 search events
- Track .mcpb file downloads as GA4 file_download events
- Track external link clicks as GA4 outbound click events
- Upgrade vue-privacy from ^1.2.3 to ^1.6.1
- Update @modelcontextprotocol/sdk from ^1.25.3 to ^1.26.0
- Update picomatch from ^4.0.0 to ^4.0.3
- Update undici from ^7.19.2 to ^7.20.0
- Update @cloudflare/workers-types from ^4.20260131.0 to ^4.20260203.0
- Update @types/node from ^24.10.9 to ^24.10.10

All tracking respects user consent - events silently dropped when analytics
consent is denied.

Closes #282
Copilot AI review requested due to automatic review settings February 4, 2026 21:42
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 4, 2026

Test Coverage Report

Overall Coverage: 95.58%

Metric Percentage
Statements 95.03%
Branches 85.83%
Functions 94.63%
Lines 95.58%

View detailed coverage report

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds GA4 event tracking capabilities to the VitePress documentation site and updates several dependencies. The implementation respects user consent through the vue-privacy library.

Changes:

  • Implements GA4 event tracking for search queries, file downloads (.mcpb files), and outbound link clicks
  • Upgrades vue-privacy from v1.2.3 to v1.6.1 to support enhanced tracking features
  • Updates six other dependencies to their latest versions

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
package.json Updates dependency versions for vue-privacy, MCP SDK, and other packages
yarn.lock Reflects the updated dependency versions with new checksums and transitive dependencies
docs/.vitepress/theme/index.ts Integrates the new GA4EventTracker component into the VitePress theme layout
docs/.vitepress/theme/composables/useGA4Tracking.ts New composable providing consent-aware GA4 event tracking functions
docs/.vitepress/theme/components/GA4EventTracker.vue New invisible component that hooks into DOM events for tracking

- Add gtag.d.ts type declaration for window.gtag function
- Fix URL parsing in trackFileDownload to handle relative paths
- Move duplicate search check inside setTimeout callback
- Use pathname.endsWith('.mcpb') instead of includes for downloads
- Use bubbling phase for click handler to reduce capture overhead
- Add JSDoc comments explaining vue-privacy VitePress usage pattern
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

…mount

- Extend gtag type to support 'event', 'config', 'set' commands per GA docs
- Make params optional in gtag signature
- Reset lastTrackedSearch on component unmount to allow re-tracking
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 6 changed files in this pull request and generated no new comments.

@polaz polaz merged commit 9d43ae6 into main Feb 4, 2026
17 checks passed
@polaz polaz deleted the feat/#282-featdocs-upgrade-vue-privacy-with-ga4-tracking--de branch February 4, 2026 22:16
sw-release-bot bot pushed a commit that referenced this pull request Feb 4, 2026
## [6.54.0](v6.53.1...v6.54.0) (2026-02-04)

### Features

* **docs:** upgrade vue-privacy with GA4 tracking + dependency updates ([#284](#284)) ([9d43ae6](9d43ae6)), closes [#282](#282)
@sw-release-bot
Copy link
Copy Markdown

sw-release-bot bot commented Feb 4, 2026

🎉 This PR is included in version 6.54.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(docs): upgrade vue-privacy with GA4 tracking + dependency updates

2 participants