1/* 2 Check for Custom Opt-Out Cookie "disable-cookieless-tracking" 3 */ 4 5const disableCookielessTracking = document.cookie.includes('disable-cookieless-tracking'); 6 7if (disableCookielessTracking) { 8 // Renew the expiration date of the cookie to avoid that the opt-out cookie will expire after 400 days. 9 document.cookie = "disable-cookieless-tracking=true;path=/;expires=Thu, 01 Jan 2100 00:00:01 GMT"; 10} else { 11 let waitForCookiemanIntervalID; 12 13 // Wait for Cookieman to be initialized. 14 waitForCookiemanIntervalID = setInterval(function () { 15 if (typeof window.cookieman === "undefined") { 16 console.log('matomo.early.js: Cookieman not initialized yet!'); 17 } else { 18 // Cookieman is initialized. 19 console.log('matomo.early.js: Cookieman instance found.'); 20 21 clearTimeout(waitForCookiemanIntervalID); 22 23 // check if Cookieman injected a script to load Matomo Statistics Container 24 let statisticInjectionDetected = document.querySelectorAll('script[data-matomo-statistics="true"]').length > 0; 25 26 let matomoStatisticsContainerUrl = TYPO3.settings.TS.matomoStatisticsContainerUrl; 27 28 // check if Cookieman is running and no Matomo Statistics Container is injected yet 29 if (!statisticInjectionDetected && typeof matomoStatisticsContainerUrl !== "undefined") { 30 /* Matomo Analytics doesn't seem to be loaded by cookieman due to missing consent */ 31 console.log('matomo.early.js: loading [Statistic-Container] via Matomo Tag Manager with Matomo Analytics and disabled Cookies due to missing consent'); 32 33 /* Disable Cookies until user gives consent via cookieman */ 34 window._paq = []; 35 window._paq.push(['requireCookieConsent']); 36 37 /************************************************************************** 38 Insert Matomo Tag Manager embed-code of the Statistic-Container below 39 **************************************************************************/ 40 41 var _mtm = window._mtm = window._mtm || []; 42 _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); 43 var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; 44 g.async = true; 45 g.src = matomoStatisticsContainerUrl; 46 s.parentNode.insertBefore(g, s); 47 48 /************************************************************************** 49 Insert Matomo Tag Manager embed-code of the Statistic-Container ABOVE 50 **************************************************************************/ 51 52 } else { 53 console.log('matomo.early.js: Matomo Analytics seems to be running (via Cookieman) - doing nothing'); 54 } 55 } 56 }, 200); 57}
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.