PageSourceSearch

https://sellantica.ai/consent-defaults.js

js sellantica.ai collected 2026-10-05 12:36:06 UTC 4,051 bytes, 67 lines download raw bytes

1// Google Consent Mode v2 defaults plus GTM loading, in ONE place.
2//
3// Muss SYNCHRON geladen werden, also ohne `async` und ohne `defer`, und vor
4// jedem anderen Tracking-Script:
5//
6//     <script src="/consent-defaults.js"></script>
7//
8// Die Defaults muessen im dataLayer stehen, bevor GTM den Queue liest. Ein
9// `defer` wuerde sie danach setzen und jedes Tag wuerde in der ersten
10// Millisekunde ungated feuern.
11//
12// Vorher lag dieser Block als Kopie in 95 HTML-Dateien, in DREI funktional
13// verschiedenen Fassungen: 61 Seiten hatten den vollstaendigen Stand, 34
14// Seiten eine aeltere Variante ohne security_storage, functionality_storage
15// und personalization_storage, ohne ads_data_redaction, ohne url_passthrough
16// und ohne die Fail-closed-Aufloesung fuer Alt-Cookies. Diese Datei ist jetzt
17// die einzige Quelle.
18window.dataLayer = window.dataLayer || [];
19      function gtag(){dataLayer.push(arguments);}
20// Auch explizit global, damit das deferred geladene klaro-config.js
21// seine consent-update-Aufrufe zuverlaessig absetzen kann.
22window.gtag = gtag;
23      var __storedConsent = (function() {
24        var match = document.cookie.match(/(?:^|; )sellantica_consent=([^;]*)/);
25        if (!match) return null;
26        try { return JSON.parse(decodeURIComponent(match[1])); } catch (e) { return null; }
27      })();
28      // Same fail-closed alias resolution as klaro-config.js's legacy-cookie
29      // migration: a pre-2026-09-01 cookie has no canonical analytics_storage
30      // / ad_storage keys yet, and without this the first consent default
31      // sent to GTM would flash denied until the deferred klaro-config.js
32      // corrects it moments later, reopening the very race this block exists
33      // to close.
34      function __resolveStoredSignal(canonicalKey, legacyKeys) {
35        if (!__storedConsent) return false;
36        if (__storedConsent[canonicalKey] === true) return true;
37        if (__storedConsent[canonicalKey] === false) return false;
38        var present = legacyKeys.filter(function(key) { return typeof __storedConsent[key] === 'boolean'; })
39          .map(function(key) { return __storedConsent[key]; });
40        return present.length > 0 && present.every(Boolean);
41      }
42      var __functionalityGranted = !!(__storedConsent && __storedConsent.functionality_storage === true);
43      var __analyticsGranted = __resolveStoredSignal('analytics_storage', ['google-analytics', 'googleAnalytics', 'analytics', 'analyse', 'posthog', 'hotjar']);
44      var __adsGranted = __resolveStoredSignal('ad_storage', ['google-ads', 'googleAds', 'ads-marketing', 'marketing', 'meta-marketing', 'meta-pixel', 'metaPixel']);
45      gtag('consent', 'default', {
46        'security_storage':        'granted',
47        'functionality_storage':   __functionalityGranted ? 'granted' : 'denied',
48        'personalization_storage': __adsGranted ? 'granted' : 'denied',
49        'analytics_storage':       __analyticsGranted ? 'granted' : 'denied',
50        'ad_storage':              __adsGranted ? 'granted' : 'denied',
51        'ad_user_data':            __adsGranted ? 'granted' : 'denied',
52        'ad_personalization':      __adsGranted ? 'granted' : 'denied',
53        'wait_for_update':         500
54      });
55      // Advanced Consent Mode: redact ad click identifiers while ad_storage
56      // is denied, and keep Google Ads conversion linking working via
57      // redirect when storage itself isn't available. Must be set before any
58      // gtag('config', ...) call, which GTM issues once it loads below.
59      gtag('set', 'ads_data_redaction', true);
60      gtag('set', 'url_passthrough', true);
61
62// Google Tag Manager
vendor: 333 bytes, lines 62-67
62
63(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
64new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
65j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
66'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
67})(window,document,'script','dataLayer','
67GTM-WTF2P3FK
vendor: 5 bytes, line 67
67');

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.