Skip to content

Commit

Permalink
fix(docs-infra): add cookie consent gtag event default state
Browse files Browse the repository at this point in the history
This PR sets a default state for cookie consent of 'denied'. The other part of the PR exists in the angular/dev-infra repo which will grant permission when the user accepts the cookie banner.
  • Loading branch information
bencodezen committed Feb 23, 2024
1 parent a9741e6 commit f172f08
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions adev/src/app/core/services/analytics/analytics.service.ts
Expand Up @@ -64,6 +64,19 @@ export class AnalyticsService {
window.gtag = function () {
window.dataLayer?.push(arguments);
};

// Cookie banner consent initial state
// This code is modified in the @angular/docs package in the cookie-banner component.
// Docs: https://developers.google.com/tag-platform/security/guides/consent
window.gtag('content', 'default', {
ad_user_data: 'denied',
ad_personalization: 'denied',
ad_storage: 'denied',
analytics_storage: 'denied',
personalization_storage: 'denied',
wait_for_update: 500
});

window.gtag('js', new Date());

// Configure properties before loading the script. This is necessary to avoid
Expand Down

0 comments on commit f172f08

Please sign in to comment.