1"use strict"; 2 3/** 4 * Sends Google Consent Mode updates when the EU Cookie Compliance status 5 * changes. Defaults are set inline in html.html.twig before GTM loads. 6 */ 7(function (Drupal) { 8 var COOKIE_VALUE_AGREED = '2'; 9 window.dataLayer = window.dataLayer || []; 10 window.gtag = window.gtag || function () { 11 window.dataLayer.push(arguments); 12 }; 13 14 // Mirrors the module's own queue shim, which adopts an existing queue, so 15 // this script works whether it loads before or after eu_cookie_compliance.js. 16 Drupal.eu_cookie_compliance = Drupal.eu_cookie_compliance || function () { 17 (Drupal.eu_cookie_compliance.queue = Drupal.eu_cookie_compliance.queue || []).push(arguments); 18 }; 19 Drupal.eu_cookie_compliance('postStatusSave', function (response) { 20 var state = response.currentStatus === COOKIE_VALUE_AGREED ? 'granted' : 'denied'; 21 window.gtag('consent', 'update', { 22 ad_storage: state, 23 ad_user_data: state, 24 ad_personalization: state, 25 analytics_storage: state 26 }); 27 window.dataLayer.push({ 28 event: 'cookie_consent_update', 29 cookie_consent: state 30 }); 31 }); 32})(Drupal);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.