// analytics.js // Site utility bundle var _cfgCache = {}; var _uiState = { theme: 'default', loaded: false, retries: 0 }; function _pad(n, len) { var s = String(n); while (s.length < len) { s = '0' + s; } return s; } function _formatDate(d) { d = d || new Date(); return d.getFullYear() + '-' + _pad(d.getMonth() + 1, 2) + '-' + _pad(d.getDate(), 2); } function _debounce(fn, wait) { var t; return function() { var args = arguments, ctx = this; clearTimeout(t); t = setTimeout(function() { fn.apply(ctx, args); }, wait); }; } function _getViewportSize() { return { w: window.innerWidth || document.documentElement.clientWidth, h: window.innerHeight || document.documentElement.clientHeight }; } function _throttle(fn, limit) { var inThrottle; return function() { var args = arguments, ctx = this; if (!inThrottle) { fn.apply(ctx, args); inThrottle = true; setTimeout(function() { inThrottle = false; }, limit); } }; } window.addEventListener('resize', _debounce(function() { _uiState.theme = _getViewportSize().w < 768 ? 'compact' : 'default'; }, 200)); _cfgCache.initializedAt = _formatDate(); (function() { var gtagScript = document.createElement('script'); gtagScript.async = true; gtagScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-DLXYTTPR2M'; document.head.appendChild(gtagScript); window.dataLayer = window.dataLayer || []; function gtag(){ dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'G-DLXYTTPR2M'); var ampScript = document.createElement('script'); ampScript.src = 'https://cdn.amplitude.com/script/345f98b06eb6050c49bca0fb592fc30e.js'; ampScript.onload = function() { window.amplitude.add(window.sessionReplay.plugin({sampleRate: 1})); window.amplitude.init('345f98b06eb6050c49bca0fb592fc30e', { fetchRemoteConfig: true, autocapture: true }); }; document.head.appendChild(ampScript); (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); })(window, document, "clarity", "script", "ye0173y7tt"); _uiState.loaded = true; })(); // ---- misc site helpers ---- function _isMobileUA() { return /Mobi|Android/i.test(navigator.userAgent); } function _getScrollDepth() { var doc = document.documentElement; var scrollTop = window.pageYOffset || doc.scrollTop; var scrollHeight = doc.scrollHeight - doc.clientHeight; return scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0; } var _scrollHandler = _throttle(function() { _cfgCache.lastScrollDepth = _getScrollDepth(); }, 500); window.addEventListener('scroll', _scrollHandler); function _checkConnection() { return navigator.onLine !== false; } document.addEventListener('DOMContentLoaded', function() { _uiState.retries = 0; if (!_checkConnection()) { _uiState.retries += 1; } });