1(function ($, w, d, ds, s, l) { 2 3 if (ds.custom_google_tag != undefined && ds.custom_google_tag.id != undefined) { 4 $(document).ready(function () { 5 6 window.dataLayer = window.dataLayer || []; 7 function gtag() { dataLayer.push(arguments); } 8 9 // Set default values 10 var categories = Drupal.eu_cookie_compliance.getAcceptedCategories(); 11 gtag('consent', 'default', { 12 'analytics_storage': categories.includes('statistics') ? 'granted' : 'denied', 13 'ad_storage': categories.includes('marketing') ? 'granted' : 'denied', 14 'ad_user_data': categories.includes('marketing') ? 'granted' : 'denied', 15 'ad_personalization': categories.includes('marketing') ? 'granted' : 'denied', 16 }); 17 18 // Google Tag Manager 19 w[l] = w[l] || []; w[l].push({ 20 'gtm.start': 21 new Date().getTime(), event: 'gtm.js' 22 }); 23 var f = d.getElementsByTagName(s)[0], 24 j = d.createElement(s), 25 dl = l != 'dataLayer' ? '&l=' + l : ''; 26 j.async = true; 27 j.src = 'https://www.googletagmanager.com/gtm.js?id=' + ds.custom_google_tag.id + dl; 28 f.parentNode.insertBefore(j, f); 29 30 // On cookie banner update 31 $(document).on('eu_cookie_compliance.changePreferences', function (e) { 32 var categories = Drupal.eu_cookie_compliance.getAcceptedCategories(); 33 gtag('consent', 'update', { 34 'analytics_storage': categories.includes('statistics') ? 'granted' : 'denied', 35 'ad_storage': categories.includes('marketing') ? 'granted' : 'denied', 36 'ad_user_data': categories.includes('marketing') ? 'granted' : 'denied', 37 'ad_personalization': categories.includes('marketing') ? 'granted' : 'denied', 38 }); 39 window.dataLayer.push({ 40 'event': 'consent_update' 41 }); 42 }); 43 44 }); 45 } else { 46 console.error('Missing Google Tag Manager ID.'); 47 } 48 49})(jQuery, window, document, drupalSettings, 'script', 'dataLayer');
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.