Skip to content

Add Mintlify analytics integration with consent management#1746

Merged
johndmulhausen merged 3 commits into
mintlify-importfrom
analytics-mintlify
Oct 21, 2025
Merged

Add Mintlify analytics integration with consent management#1746
johndmulhausen merged 3 commits into
mintlify-importfrom
analytics-mintlify

Conversation

@johndmulhausen

Copy link
Copy Markdown
Contributor

Summary

This PR adds analytics integration for Mintlify documentation with proper consent management.

Changes

  • Added OneTrust cookie consent management: Integrates with OneTrust for GDPR-compliant cookie consent
  • Segment Analytics integration: Uses self-hosted Segment build at wandb.ai/sa-docs.min.js
  • Microsoft Clarity analytics: Added for user behavior insights
  • Consent-based loading: Analytics scripts only load when users grant marketing or statistics consent
  • User engagement tracking: Added user engagement tracking script

Key Features

  1. Privacy-first approach: Analytics only loads after user consent
  2. Consent synchronization: Implements wpConsentSync to manage different consent categories:
    • Statistics
    • Marketing
    • Functional
    • Preferences
  3. Performance: Scripts load asynchronously to minimize impact on page load

Implementation Details

The implementation follows these steps:

  1. Load the user engagement and OneTrust scripts
  2. Wait for user consent via OneTrust
  3. Only load analytics (Segment & Clarity) if marketing or statistics consent is granted
  4. Fire analytics.page() when Segment is ready

Testing

  • Verify OneTrust banner appears correctly
  • Confirm analytics only loads with proper consent
  • Check that Segment and Clarity are tracking correctly when consent is given

- Add OneTrust cookie consent management integration
- Add Segment analytics with self-hosted build (wandb.ai/sa-docs.min.js)
- Add Microsoft Clarity analytics
- Implement consent-based loading: analytics only loads when user grants marketing or statistics consent
- Add user engagement tracking script
- Implement wpConsentSync for managing consent categories
- Introduced Google Analytics 4 (GA4) integration with measurement ID.
- Added Google Tag Manager (GTM) integration with tag ID.
- Enhancements to the analytics configuration for improved tracking.
@johndmulhausen johndmulhausen requested a review from a team as a code owner October 21, 2025 19:12
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 21, 2025

Copy link
Copy Markdown

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 06752b7
Status:🚫  Build failed.

View logs

@socket-security

socket-security Bot commented Oct 21, 2025

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@johndmulhausen johndmulhausen changed the base branch from main to mintlify-import October 21, 2025 19:13
@johndmulhausen johndmulhausen merged commit 011098f into mintlify-import Oct 21, 2025
4 of 5 checks passed
@johndmulhausen johndmulhausen deleted the analytics-mintlify branch October 21, 2025 19:15
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