| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/prosvasi/wp-content/plugins/wp-statistics/assets/dev/javascript/ |
Upload File : |
document.addEventListener('DOMContentLoaded', function handler() {
// Defer until a prerendered document is activated by user navigation.
// The server drops prerender hits via Sec-Purpose, and activation does
// not re-run scripts — without this gate the real pageview is lost.
if (document.prerendering) {
document.addEventListener('prerenderingchange', handler, { once: true });
return;
}
const consentIntegration = WP_Statistics_Tracker_Object.option.consentIntegration.name;
// If there's no consent integration, or borlabs cookie integration is enabled
if (!consentIntegration || consentIntegration === 'borlabs_cookie') {
WpStatisticsUserTracker.init();
WpStatisticsEventTracker.init();
}
// If WP Consent API integration is enabled
if (consentIntegration === 'wp_consent_api') {
handleWpConsentApiIntegration();
}
// If Real Cookie Banner integration is enabled
if (consentIntegration === 'real_cookie_banner') {
handleRealCookieBannerIntegration();
}
});
function handleWpConsentApiIntegration() {
if (wp_has_consent('statistics') || wp_has_consent('statistics-anonymous')) {
WpStatisticsUserTracker.init();
WpStatisticsEventTracker.init();
}
document.addEventListener("wp_listen_for_consent_change", function (e) {
const changedConsentCategory = e.detail;
for (let key in changedConsentCategory) {
if (changedConsentCategory.hasOwnProperty(key)) {
if ((key === 'statistics' || key === 'statistics-anonymous') && changedConsentCategory[key] === 'allow') {
WpStatisticsUserTracker.init();
WpStatisticsEventTracker.init();
}
}
}
});
}
function handleRealCookieBannerIntegration() {
(window.consentApi?.consent("wp-statistics") || Promise.resolve())
.then(() => {
// In case the user has given consent
WpStatisticsUserTracker.init();
WpStatisticsEventTracker.init();
})
.catch(() => {
// In case the user has not given base consent,
// check if they have given consent for data processing service
const dataProcessing = window.consentApi?.consentSync("wp-statistics-with-data-processing");
if (dataProcessing.cookie != null && dataProcessing.cookieOptIn) {
WpStatisticsUserTracker.init();
WpStatisticsEventTracker.init();
} else {
console.log("WP Statistics: Real Cookie Banner consent is not given to track visitor information.");
}
});
}