Skip to content

Gate analytics on consent and fix Matomo SPA page views#849

Open
TechHutTV wants to merge 1 commit into
mainfrom
docs/privacy-cookie-consent-matomo
Open

Gate analytics on consent and fix Matomo SPA page views#849
TechHutTV wants to merge 1 commit into
mainfrom
docs/privacy-cookie-consent-matomo

Conversation

@TechHutTV

Copy link
Copy Markdown
Collaborator

Description

Align the documentation site's analytics behavior with the updated privacy and cookie-consent model.

Matomo and Google Tag Manager now load only after a visitor explicitly accepts analytics cookies. Visitors can reopen Cookie Settings from the footer, and withdrawing consent removes known tracking cookies before reloading the site without analytics scripts.

This also changes Matomo from cookie-only consent to full tracking consent and adds an explicit SPA page-view event after Next.js finishes updating the URL and document title. This prevents Matomo from associating a new URL with the previous page's title during client-side navigation.

Changes

  • Load Matomo Tag Manager only after analytics consent is accepted.
  • Load Google Tag Manager only after analytics consent is accepted.
  • Keep analytics available during local development so the consent flow can be tested locally.
  • Replace Matomo cookie-only consent with full tracking consent using requireConsent and setConsentGiven.
  • Emit mtm.SpaPageView after client-side route changes so Matomo receives the current URL and page title together.
  • Preserve the initial hard-load page view for the Matomo container's existing PageView trigger.
  • Store accepted and declined choices for 180 days.
  • Resolve stored consent after hydration so analytics remains disabled while the visitor's choice is loading.
  • Remove known Matomo, Google, HubSpot, Hotjar, and Microsoft Clarity tracking cookies when consent is withdrawn.
  • Revoke Matomo consent, delete Matomo cookies, and reload after an accepted visitor changes their choice to declined.
  • Add a persistent Cookie Settings control to the footer.
  • Move Google Tag Manager out of _document so it can be mounted conditionally from the consent-aware application tree.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@TechHutTV, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ac1f9644-d556-4a59-be2c-856fc64e8d08

📥 Commits

Reviewing files that changed from the base of the PR and between ae35274 and f356a4e.

📒 Files selected for processing (6)
  • src/components/Footer.jsx
  • src/components/GoogleTagManager.jsx
  • src/components/Matomo.jsx
  • src/components/cookie-consent/CookieConsentProvider.jsx
  • src/pages/_app.jsx
  • src/pages/_document.jsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/privacy-cookie-consent-matomo

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@TechHutTV TechHutTV force-pushed the docs/privacy-cookie-consent-matomo branch from 82d08be to f356a4e Compare July 13, 2026 20:37
@TechHutTV TechHutTV requested review from heisbrot and mlsmaycon July 14, 2026 06:02
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