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 29, 2024
1 parent b322079 commit c13a5b1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions adev/src/app/core/services/analytics/analytics.service.ts
Expand Up @@ -64,6 +64,18 @@ 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-popup 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',
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 c13a5b1

Please sign in to comment.