Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only include Google Analytics tracking script if the privacy consent was given #13825

Closed
Piedone opened this issue Jun 7, 2023 · 0 comments · Fixed by #13834
Closed

Only include Google Analytics tracking script if the privacy consent was given #13825

Piedone opened this issue Jun 7, 2023 · 0 comments · Fixed by #13834

Comments

@Piedone
Copy link
Member

Piedone commented Jun 7, 2023

Is your feature request related to a problem? Please describe.

The Google Analytics feature always includes the GA tracking script in GoogleAnalyticsFilter. Instead, it should only include this if the user gave consent to tracking, otherwise, it's a legal risk under GDPR for EU companies. Potentially something similar for websites run by other entities around the world too.

Describe the solution you'd like

The built-in ASP.NET Core feature can be used for this, just by adding the below check to GoogleAnalyticsFilter:

var trackingConsentFeature = _hca.HttpContext.Features.Get<ITrackingConsentFeature>();

if (trackingConsentFeature is null || trackingConsentFeature.CanTrack)
{
     // Only insert the tracking script here.
}

Describe alternatives you've considered

There are no alternatives, and I'm afraid because this is what our legal counsel told us:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants