1(function () { 2 if (typeof CookieConsent === 'undefined') return; 3 4 const GA_MEASUREMENT_ID = 'G-51NR6MZWCT'; 5 const siteConfig = window.SeoVaultSiteConfig || {}; 6 const CLARITY_PROJECT_ID = String(siteConfig.clarityProjectId || 'ws16zvbyke').trim(); 7 let analyticsInitialized = false; 8 let analyticsLoadPromise = null; 9 let clarityInitialized = false; 10 let clarityLoadPromise = null; 11 12 function ensureGtag() { 13 window.dataLayer = window.dataLayer || []; 14 if (typeof window.gtag !== 'function') { 15 window.gtag = function gtag() { 16 window.dataLayer.push(arguments); 17 }; 18 } 19 } 20 21 function updateAnalyticsConsent(granted) { 22 if (typeof window.gtag !== 'function') return; 23 24 window.gtag('consent', 'update', { 25 analytics_storage: granted ? 'granted' : 'denied', 26 ad_storage: 'denied', 27 ad_user_data: 'denied', 28 ad_personalization: 'denied' 29 }); 30 } 31 32 function ensureClarity() { 33 if (typeof window.clarity === 'function') return; 34 35 window.clarity = function clarity() { 36 window.clarity.q = window.clarity.q || []; 37 window.clarity.q.push(arguments); 38 }; 39 } 40 41 function updateClarityConsent(granted) { 42 if (!CLARITY_PROJECT_ID || typeof window.clarity !== 'function') return; 43 44 window.clarity('consentv2', { 45 ad_Storage: 'denied', 46 analytics_Storage: granted ? 'granted' : 'denied' 47 }); 48 } 49 50 function loadAnalytics() { 51 if (analyticsLoadPromise) return analyticsLoadPromise; 52 53 ensureGtag(); 54 window.gtag('js', new Date()); 55 window.gtag('consent', 'default', { 56 analytics_storage: 'denied', 57 ad_storage: 'denied', 58 ad_user_data: 'denied', 59 ad_personalization: 'denied' 60 }); 61 window.gtag('config', GA_MEASUREMENT_ID, { 62 anonymize_ip: true 63 }); 64 65 analyticsLoadPromise = new Promise((resolve, reject) => { 66 const existing = document.querySelector('script[data-seovault-analytics="true"]'); 67 if (existing) { 68 analyticsInitialized = true; 69 resolve(); 70 return; 71 } 72 73 const script = document.createElement('script'); 74 script.async = true; 75 script.src = `https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(GA_MEASUREMENT_ID)}`; 76 script.dataset.seovaultAnalytics = 'true'; 77 script.onload = function () { 78 analyticsInitialized = true; 79 resolve(); 80 }; 81 script.onerror = function () { 82 analyticsLoadPromise = null; 83 reject(new Error('Failed to load Google Analytics.')); 84 }; 85 document.head.appendChild(script); 86 }).catch(function () { 87 return null; 88 }); 89 90 return analyticsLoadPromise; 91 } 92 93 function loadClarity() { 94 if (!CLARITY_PROJECT_ID) return Promise.resolve(null); 95 if (clarityLoadPromise) return clarityLoadPromise; 96 97 ensureClarity(); 98 updateClarityConsent(false); 99 100 clarityLoadPromise = new Promise((resolve, reject) => { 101 const existing = document.querySelector('script[data-seovault-clarity="true"]'); 102 if (existing) { 103 clarityInitialized = true; 104 resolve(); 105 return; 106 } 107 108 const script = document.createElement('script'); 109 script.async = true; 110 script.src = `https://www.clarity.ms/tag/${encodeURIComponent(CLARITY_PROJECT_ID)}`; 111 script.dataset.seovaultClarity = 'true'; 112 script.onload = function () { 113 clarityInitialized = true; 114 if (typeof window.clarity === 'function') { 115 window.clarity('set', 'surface', 'marketing-site'); 116 window.clarity('set', 'environment', siteConfig.environment || 'prod'); 117 } 118 resolve(); 119 }; 120 script.onerror = function () { 121 clarityLoadPromise = null; 122 reject(new Error('Failed to load Microsoft Clarity.')); 123 }; 124 document.head.appendChild(script); 125 }).catch(function () { 126 return null; 127 }); 128 129 return clarityLoadPromise; 130 } 131 132 function syncAnalyticsConsent() { 133 const analyticsAllowed = typeof CookieConsent.acceptedCategory === 'function' 134 && CookieConsent.acceptedCategory('analytics'); 135 136 if (!analyticsAllowed) { 137 if (analyticsInitialized) { 138 updateAnalyticsConsent(false); 139 } 140 if (clarityInitialized) { 141 updateClarityConsent(false); 142 } 143 return; 144 } 145 146 loadAnalytics().then(function () { 147 updateAnalyticsConsent(true); 148 }); 149 150 loadClarity().then(function () { 151 updateClarityConsent(true); 152 }); 153 } 154 155 CookieConsent.run({ 156 root: 'body', 157 autoShow: true, 158 disablePageInteraction: true, 159 lazyHtmlGeneration: true, 160 hideFromBots: true, 161 162 cookie: { 163 name: 'seovault_cc', 164 expiresAfterDays: 182, 165 domain: window.location.hostname, 166 path: '/', 167 sameSite: 'Lax' 168 }, 169 170 guiOptions: { 171 consentModal: { 172 layout: 'bar inline', 173 position: 'bottom', 174 equalWeightButtons: true,
175 flipButtons: false 176 }, 177 preferencesModal: { 178 layout: 'box', 179 position: 'right', 180 equalWeightButtons: true, 181 flipButtons: false 182 } 183 }, 184 185 categories: { 186 necessary: { 187 enabled: true, 188 readOnly: true 189 }, 190 functional: { 191 enabled: true 192 }, 193 analytics: { 194 enabled: false 195 } 196 }, 197 198 language: { 199 default: 'en', 200 translations: { 201 en: { 202 consentModal: { 203 title: 'We value your privacy', 204 description: 'We use cookies to improve your experience, remember your preferences, and understand how our site is used. You can accept all cookies or manage your preferences.', 205 acceptAllBtn: 'Accept all', 206 acceptNecessaryBtn: 'Reject all', 207 showPreferencesBtn: 'Manage preferences', 208 footer: '<a href="/privacy/">Privacy Policy</a> <a href="/cookies/">Cookie Policy</a>' 209 }, 210 preferencesModal: { 211 title: 'Cookie preferences', 212 acceptAllBtn: 'Accept all', 213 acceptNecessaryBtn: 'Reject all', 214 savePreferencesBtn: 'Save preferences', 215 closeIconLabel: 'Close', 216 serviceCounterLabel: 'Service|Services', 217 sections: [ 218 { 219 title: 'Strictly Necessary', 220 description: 'These cookies are essential for the website and web app to function properly. They cannot be disabled.', 221 linkedCategory: 'necessary' 222 }, 223 { 224 title: 'Functional', 225 description: 'These cookies enable enhanced functionality and personalization, such as remembering your theme preference.', 226 linkedCategory: 'functional' 227 }, 228 { 229 title: 'Analytics', 230 description: 'These cookies help us understand how visitors interact with our website so we can improve the experience. They support tools such as Google Analytics and Microsoft Clarity for page flow, click, and scroll analysis.', 231 linkedCategory: 'analytics' 232 }, 233 { 234 title: 'More information', 235 description: 'For more details about how we handle cookies and your data, please read our <a href="/cookies/">Cookie Policy</a> and <a href="/privacy/">Privacy Policy</a>.' 236 } 237 ] 238 } 239 } 240 } 241 }, 242 243 onFirstConsent: function () { 244 syncAnalyticsConsent(); 245 }, 246 247 onConsent: function () { 248 syncAnalyticsConsent(); 249 }, 250 251 onChange: function () { 252 syncAnalyticsConsent(); 253 } 254 }); 255})();
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.