Skip to content

Add clarity cookie consent to docs site#1908

Merged
SharonHart merged 2 commits intomainfrom
shhart/feature/clarity-cookie-consent
Mar 16, 2026
Merged

Add clarity cookie consent to docs site#1908
SharonHart merged 2 commits intomainfrom
shhart/feature/clarity-cookie-consent

Conversation

@SharonHart
Copy link
Copy Markdown
Contributor

This pull request adds a cookie consent mechanism for Microsoft Clarity analytics to overrides/main.html. The main goal is to comply with privacy requirements by allowing users to explicitly accept or decline analytics cookies, and to remember their choice for future visits.

The most important changes are:

Analytics and Consent Integration:

  • Integrated Microsoft Clarity analytics with support for Consent Mode, allowing the site to respect users' cookie preferences. Consent state is restored from localStorage on page load, ensuring consistent behavior across sessions.

User Interface Enhancements:

  • Added a cookie consent banner with "Accept" and "Decline" buttons, styled for visibility and accessibility. The banner appears only if the user has not previously made a choice.
  • When a user makes a choice, their preference is saved to localStorage and the banner is removed, updating Clarity's consent state accordingly.

Accessibility and UX:

  • The banner uses appropriate ARIA roles and labels to ensure accessibility for screen readers.
  • Includes a link to Microsoft Clarity's cookie documentation for transparency.

@github-actions
Copy link
Copy Markdown

Coverage report (presidio-anonymizer)

This PR does not seem to contain any modification to coverable code.

@github-actions
Copy link
Copy Markdown

Coverage report (presidio-structured)

This PR does not seem to contain any modification to coverable code.

@github-actions
Copy link
Copy Markdown

Coverage report (presidio-cli)

This PR does not seem to contain any modification to coverable code.

Copy link
Copy Markdown
Contributor

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

Adds Microsoft Clarity analytics integration to the documentation site along with a custom consent banner, implemented via the MkDocs/MkDocs-Material overrides/main.html template.

Changes:

  • Inject Microsoft Clarity tracking script into the docs theme analytics block.
  • Add a cookie consent banner (CSS + JS) and persist user choice in localStorage.
  • Apply stored consent choice to Clarity via clarity("consentv2", ...).

You can also share your feedback on Copilot code review. Take the survey.

Comment thread overrides/main.html Outdated
Comment thread overrides/main.html Outdated
Comment thread overrides/main.html
Comment thread overrides/main.html
Comment thread overrides/main.html
@github-actions
Copy link
Copy Markdown

Coverage report (presidio-image-redactor)

This PR does not seem to contain any modification to coverable code.

@github-actions
Copy link
Copy Markdown

Coverage report (presidio-analyzer)

This PR does not seem to contain any modification to coverable code.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@SharonHart SharonHart merged commit 2450561 into main Mar 16, 2026
59 of 61 checks passed
@SharonHart SharonHart deleted the shhart/feature/clarity-cookie-consent branch March 16, 2026 15:24
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.

3 participants