Skip to content

feat: gate GA4 analytics behind a cookie consent banner#17

Open
mounibec wants to merge 1 commit into
mainfrom
feat/analytics
Open

feat: gate GA4 analytics behind a cookie consent banner#17
mounibec wants to merge 1 commit into
mainfrom
feat/analytics

Conversation

@mounibec

Copy link
Copy Markdown
Member

No description provided.

@mounibec mounibec requested a review from Copilot June 17, 2026 22:34
@mintlify

mintlify Bot commented Jun 17, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
velora 🟢 Ready View Preview Jun 17, 2026, 10:35 PM

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a client-side cookie consent banner intended to keep GA4 disabled until the visitor opts in, aligning analytics collection with explicit consent on the docs site.

Changes:

  • Introduces a new consent.js script that configures Google Consent Mode defaults to “denied”.
  • Loads the Vanilla CookieConsent library + stylesheet from jsDelivr and renders a consent/preferences modal.
  • Loads GA4 (gtag.js) only after the user grants the “analytics” category, and syncs consent changes to Google.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread consent.js
Comment on lines +54 to +58
analytics_storage: state,
ad_storage: state,
ad_user_data: state,
ad_personalization: state,
});
Comment thread consent.js
Comment on lines +1 to +3
const GA4_MEASUREMENT_ID = 'G-4D17CZC526';
const COOKIECONSENT_VERSION = '3.1.0';
const CDN = `https://cdn.jsdelivr.net/npm/vanilla-cookieconsent@${COOKIECONSENT_VERSION}/dist`;
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.

2 participants