(function(){const wReport = (function() { "use strict";const scriptTag = document.currentScript || document.querySelector('script[data-site-id]');const scriptUrl = scriptTag ? scriptTag.src : '';const endpointUrl = scriptUrl.replace(/\.js.php$/, '.php');const config = { endpoint: endpointUrl, siteId: scriptTag ? scriptTag.getAttribute('data-site-id') : 'unknown' };let startTime = Date.now();let maxScroll = 0;const updateScrollStats = () => { const scrollTop = window.pageYOffset || document.documentElement.scrollTop;const windowHeight = document.documentElement.clientHeight;const scrollHeight = document.documentElement.scrollHeight;const totalScrollable = scrollHeight - windowHeight;if (totalScrollable > 0) { const scrollPercent = Math.round((scrollTop / totalScrollable) * 100);if (scrollPercent > maxScroll) maxScroll = scrollPercent;} };updateScrollStats();window.addEventListener('scroll', updateScrollStats, { passive: true });const getBrowserInfo = () => { const ua = navigator.userAgent;let browser = "Unknown";let os = "Unknown";let hardware = window.innerWidth < 768 ? "mobile" : "desktop";if (ua.indexOf("Win") !== -1) os = "Windows";else if (ua.indexOf("Mac") !== -1) os = "MacOS";else if (ua.indexOf("Linux") !== -1) os = "Linux";else if (ua.indexOf("Android") !== -1) os = "Android";else if (ua.indexOf("like Mac") !== -1) os = "iOS";if (ua.indexOf("Firefox") > -1) browser = "Firefox";else if (ua.indexOf("Chrome") > -1) browser = "Chrome";else if (ua.indexOf("Safari") > -1 && ua.indexOf("Chrome") === -1) browser = "Safari";const isBot = /bot|googlebot|crawler|spider|robot|crawling/i.test(ua) || navigator.webdriver || window.callPhantom || window._phantom;return { browser, os, hardware, screen: `${window.screen.width}x${window.screen.height}`, domain: window.location.hostname, language: navigator.language || 'unknown', is_bot: isBot ? 1 : 0 };};const _send = (data) => { const blob = new Blob([JSON.stringify(data)], { type: 'application/json' });if (navigator.sendBeacon) { navigator.sendBeacon(config.endpoint, blob);} else { fetch(config.endpoint, { method: 'POST', body: blob, keepalive: true });} };const track = (eventName, eventData = null) => { const info = getBrowserInfo();let extraData = (typeof eventData === 'object' && eventData !== null) ? { ...eventData } : {};if (eventName === 'page_exit') { const scrollHeight = document.documentElement.scrollHeight;const windowHeight = document.documentElement.clientHeight;const canScroll = scrollHeight > windowHeight;extraData.duration_seconds = Math.round((Date.now() - startTime) / 1000);extraData.max_scroll_percent = canScroll ? maxScroll : 100;extraData.can_scroll = canScroll;} const _0x8fa1 = { site_id: config.siteId, path: extraData.path ? extraData.path : window.location.pathname, referrer: document.referrer, event_name: eventName, event_data: { ...info, ...extraData } };_send(_0x8fa1);};const init = () => { if (document.readyState === 'complete') track('page_view');else window.addEventListener('load', () => track('page_view'));document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'hidden') { track('page_exit');} });document.addEventListener('click', function(e) { const link = e.target.closest('a');if (link && link.href) { const url = link.href.toLowerCase();if (url.endsWith('.pdf')) { track("download_pdf", { file_name: link.href.split('/').pop(), url: link.href });} else if (url.startsWith('http') && !url.includes(window.location.hostname)) { track("external_link_click", { url: link.href });} } });};init();return { event: (name, data) => { let parsedData = data;if (typeof data === 'string') { try { parsedData = JSON.parse(data);} catch (e) { parsedData = { raw_data: data };} } track(name, parsedData);} };})();})();