- return unless google_tag_manager_enabled? - if Feature.enabled?(:gitlab_gtm_datalayer, type: :ops) = javascript_tag do :plain window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('consent', 'default', { 'analytics_storage': 'granted', 'ad_storage': 'granted', 'functionality_storage': 'granted', 'wait_for_update': 500 }); gtag('consent', 'default', { 'analytics_storage': 'denied', 'ad_storage': 'denied', 'functionality_storage': 'denied', 'region': ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'IS', 'LI', 'NO', 'GB', 'PE', 'RU'], 'wait_for_update': 500 }); window.geofeed = (options) => { dataLayer.push({ 'event' : 'OneTrustCountryLoad', 'oneTrustCountryId': options.country.toString() }) } const json = document.createElement('script'); json.setAttribute('src', 'https://geolocation.onetrust.com/cookieconsentpub/v1/geo/location/geofeed'); document.head.appendChild(json); - if Feature.enabled?(:gtm_nonce, type: :ops) = javascript_tag nonce: content_security_policy_nonce do :plain (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;j.setAttribute('nonce', '#{content_security_policy_nonce}');f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','#{google_tag_manager_id}'); - else = javascript_tag do :plain (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','#{google_tag_manager_id}');