Fix Microsoft Clarity consent API property names for GDPR compliance#786
Merged
BenjaminMichaelis merged 4 commits intomainfrom Sep 21, 2025
Merged
Conversation
… testing Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Review Consent for this site which deploys to https://essentialcsharp.com . Make sure we are properly compliant. Use playwright mcp tool as needed.
https://learn.microsoft.com/en-us/clarity/setup-and-installation/consent-mode
https://learn.microsoft....
Fix Microsoft Clarity consent API property names for GDPR compliance
Sep 20, 2025
Copilot stopped work on behalf of
BenjaminMichaelis due to an error
September 20, 2025 19:56
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes critical GDPR compliance issues in the Microsoft Clarity consent implementation by correcting property names in the consent API call. The incorrect camelCase property names were preventing proper consent signal transmission to Microsoft Clarity, potentially causing compliance violations ahead of the October 31, 2025 enforcement deadline.
Key Changes
- Fixed property names in Microsoft Clarity consent API from camelCase to lowercase with underscores
- Ensures proper consent state communication for users in EEA, UK, and Switzerland regions
- Maintains compliance with GDPR requirements for user privacy controls
BenjaminMichaelis
added a commit
that referenced
this pull request
Apr 25, 2026
…786) Fixes critical Microsoft Clarity consent implementation to ensure compliance with GDPR requirements ahead of the October 31, 2025 enforcement deadline. ## Problem The Microsoft Clarity consent API call was using incorrect property names, preventing proper consent signal transmission: ```javascript // ❌ Incorrect - using camelCase clarity('consentv2', { ad_Storage: this.consentState.ad_storage, analytics_Storage: this.consentState.analytics_storage }); ``` This meant that user consent preferences were not being properly communicated to Microsoft Clarity, potentially causing compliance issues for users in EEA, UK, and Switzerland regions. ## Solution Updated the consent API call to use the correct property names as specified in Microsoft's documentation: ```javascript // ✅ Correct - using lowercase with underscores clarity('consentv2', { ad_storage: this.consentState.ad_storage, analytics_storage: this.consentState.analytics_storage }); ``` ## Testing Added comprehensive testing tools including Microsoft's recommended verification function: ```javascript // Microsoft's official verification function clarity('metadata', (d, upgrade, consent) => { console.log('consentStatus:', consent); }, false, true, true); ``` The implementation now correctly shows: - **Consent DENIED**: `{analytics_storage: "DENIED", ad_storage: "DENIED"}` - **Consent GRANTED**: `{analytics_storage: "GRANTED", ad_storage: "GRANTED"}` ## Screenshot  The test page demonstrates successful consent state management with proper API integration. ## Impact - ✅ **Compliance**: Site now properly implements Microsoft Clarity consent mode - ✅ **Privacy**: User consent preferences are correctly respected - ✅ **Functionality**: Clarity tracking works as expected based on consent state - ✅ **Future-proof**: Ready for October 2025 enforcement requirements This minimal but critical fix ensures that essentialcsharp.com maintains proper user privacy controls while enabling full Microsoft Clarity functionality when consent is granted. <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/IntelliTect/EssentialCSharp.Web/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com> Co-authored-by: Benjamin Michaelis <git@relay.benjamin.michaelis.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes critical Microsoft Clarity consent implementation to ensure compliance with GDPR requirements ahead of the October 31, 2025 enforcement deadline.
Problem
The Microsoft Clarity consent API call was using incorrect property names, preventing proper consent signal transmission:
This meant that user consent preferences were not being properly communicated to Microsoft Clarity, potentially causing compliance issues for users in EEA, UK, and Switzerland regions.
Solution
Updated the consent API call to use the correct property names as specified in Microsoft's documentation:
Testing
Added comprehensive testing tools including Microsoft's recommended verification function:
The implementation now correctly shows:
{analytics_storage: "DENIED", ad_storage: "DENIED"}{analytics_storage: "GRANTED", ad_storage: "GRANTED"}Screenshot
The test page demonstrates successful consent state management with proper API integration.
Impact
This minimal but critical fix ensures that essentialcsharp.com maintains proper user privacy controls while enabling full Microsoft Clarity functionality when consent is granted.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.