D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
oems
/
wp-content
/
plugins
/
wp-statistics
/
assets
/
js
/
Filename :
tracker.min.js
back
Copy
function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _regenerator(){var h,t="function"==typeof Symbol?Symbol:{},e=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function n(t,e,r,n){var i,a,o,s,c,u,l,f,d,e=e&&e.prototype instanceof v?e:v,e=Object.create(e.prototype);return _regeneratorDefine2(e,"_invoke",(i=t,a=r,l=n||[],f=!1,d={p:u=0,n:0,v:h,a:p,f:p.bind(h,4),d:function(t,e){return o=t,s=0,c=h,d.n=e,_}},function(t,e,r){if(1<u)throw TypeError("Generator is already running");for(f&&1===e&&p(e,r),s=e,c=r;(y=s<2?h:c)||!f;){o||(s?s<3?(1<s&&(d.n=-1),p(s,c)):d.n=c:d.v=c);try{if(u=2,o){if(y=o[t=s?t:"next"]){if(!(y=y.call(o,c)))throw TypeError("iterator result is not an object");if(!y.done)return y;c=y.value,s<2&&(s=0)}else 1===s&&(y=o.return)&&y.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+t+"' method"),s=1);o=h}else if((y=(f=d.n<0)?c:i.call(a,d))!==_)break}catch(t){o=h,s=1,c=t}finally{u=1}}return{value:y,done:f}}),!0),e;function p(t,e){for(s=t,c=e,y=0;!f&&u&&!r&&y<l.length;y++){var r,n=l[y],i=d.p,a=n[2];3<t?(r=a===e)&&(c=n[(s=n[4])?5:s=3],n[4]=n[5]=h):n[0]<=i&&((r=t<2&&i<n[1])?(s=0,d.v=e,d.n=n[1]):i<a&&(r=t<3||n[0]>e||a<e)&&(n[4]=t,n[5]=e,d.n=a,s=0))}if(r||1<t)return _;throw f=!0,e}}var _={};function v(){}function i(){}function a(){}var y=Object.getPrototypeOf,t=[][e]?y(y([][e]())):(_regeneratorDefine2(y={},e,function(){return this}),y),o=a.prototype=v.prototype=Object.create(t);function s(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,_regeneratorDefine2(t,r,"GeneratorFunction")),t.prototype=Object.create(o),t}return _regeneratorDefine2(o,"constructor",i.prototype=a),_regeneratorDefine2(a,"constructor",i),_regeneratorDefine2(a,r,i.displayName="GeneratorFunction"),_regeneratorDefine2(o),_regeneratorDefine2(o,r,"Generator"),_regeneratorDefine2(o,e,function(){return this}),_regeneratorDefine2(o,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:n,m:s}})()}function _regeneratorDefine2(t,e,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}(_regeneratorDefine2=function(t,e,r,n){function i(e,r){_regeneratorDefine2(t,e,function(t){return this._invoke(e,r,t)})}e?a?a(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))})(t,e,r,n)}function ownKeys(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _defineProperty(t,e,r){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}function asyncGeneratorStep(t,e,r,n,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,i)}function _asyncToGenerator(s){return function(){var t=this,o=arguments;return new Promise(function(e,r){var n=s.apply(t,o);function i(t){asyncGeneratorStep(n,e,r,i,a,"next",t)}function a(t){asyncGeneratorStep(n,e,r,i,a,"throw",t)}i(void 0)})}}function handleWpConsentApiIntegration(){(wp_has_consent("statistics")||wp_has_consent("statistics-anonymous"))&&(WpStatisticsUserTracker.init(),WpStatisticsEventTracker.init()),document.addEventListener("wp_listen_for_consent_change",function(t){var e,r=t.detail;for(e in r)!r.hasOwnProperty(e)||"statistics"!==e&&"statistics-anonymous"!==e||"allow"!==r[e]||(WpStatisticsUserTracker.init(),WpStatisticsEventTracker.init())})}function handleRealCookieBannerIntegration(){var t;((null==(t=window.consentApi)?void 0:t.consent("wp-statistics"))||Promise.resolve()).then(function(){WpStatisticsUserTracker.init(),WpStatisticsEventTracker.init()}).catch(function(){var t=null==(t=window.consentApi)?void 0:t.consentSync("wp-statistics-with-data-processing");null!=t.cookie&&t.cookieOptIn?(WpStatisticsUserTracker.init(),WpStatisticsEventTracker.init()):console.log("WP Statistics: Real Cookie Banner consent is not given to track visitor information.")})}window.WpStatisticsUserTracker||(window.WpStatisticsUserTracker={lastUrl:window.location.href,originalPushState:history.pushState,originalReplaceState:history.replaceState,isDndActive:parseInt(navigator.msDoNotTrack||window.doNotTrack||navigator.doNotTrack,10),hasTrackerInitializedOnce:!1,hasUrlChangeTrackerInitialized:!1,hitRequestSuccessful:!0,init:function(){this.hasTrackerInitializedOnce||(this.hasTrackerInitializedOnce=!0,WP_Statistics_Tracker_Object.option.isPreview)||(void 0===WP_Statistics_Tracker_Object?console.error("WP Statistics: Variable WP_Statistics_Tracker_Object not found. Ensure /wp-content/plugins/wp-statistics/assets/js/tracker.js is either excluded from cache settings or not dequeued by any plugin. Clear your cache if necessary."):this.checkHitRequestConditions(),this.trackUrlChange())},base64Encode:function(t){return t=(new TextEncoder).encode(t),btoa(String.fromCharCode.apply(null,t))},getPathAndQueryString:function(){var t=window.location.pathname,e=window.location.search;return this.base64Encode(t+e)},getReferred:function(){return this.base64Encode(document.referrer)},checkHitRequestConditions:function(){WP_Statistics_Tracker_Object.option.dntEnabled&&1===this.isDndActive?console.log("WP Statistics: Do Not Track (DNT) is enabled. Hit request not sent."):this.sendHitRequest()},sendHitRequest:(()=>{var t=_asyncToGenerator(_regenerator().m(function t(){var e,r,n;return _regenerator().w(function(t){for(;;)switch(t.n){case 0:try{e=this.getRequestUrl(),r=new URLSearchParams(_objectSpread(_objectSpread({},WP_Statistics_Tracker_Object.hitParams),{},{referred:this.getReferred(),page_uri:this.getPathAndQueryString()})).toString(),(n=new XMLHttpRequest).open("POST",e,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.send(r),n.onreadystatechange=function(){var t;4===n.readyState&&(200===n.status?(t=JSON.parse(n.responseText),this.hitRequestSuccessful=!1!==t.status):(this.hitRequestSuccessful=!1,console.warn("WP Statistics: Hit request failed with status "+n.status)))}.bind(this)}catch(t){this.hitRequestSuccessful=!1,console.error("WP Statistics: Error sending hit request:",t)}case 1:return t.a(2)}},t,this)}));return function(){return t.apply(this,arguments)}})(),getRequestUrl:function(){var t=WP_Statistics_Tracker_Object.requestUrl+"/";return WP_Statistics_Tracker_Object.option.bypassAdBlockers?t=WP_Statistics_Tracker_Object.ajaxUrl:t+=WP_Statistics_Tracker_Object.hitParams.endpoint,t},updateTrackerObject:function(i){var a=!1,o=0;setTimeout(function t(){var e=document.getElementById("wp-statistics-tracker-js-extra");if(e)try{var r,n=e.innerHTML.match(/var\s+WP_Statistics_Tracker_Object\s*=\s*(\{[\s\S]*?\});/);n&&n[1]&&(r=JSON.parse(n[1]),!WP_Statistics_Tracker_Object.hitParams||JSON.stringify(WP_Statistics_Tracker_Object.hitParams)!==JSON.stringify(r.hitParams))?(WP_Statistics_Tracker_Object=r,!a&&i&&(a=!0,i())):++o<20?setTimeout(t,100):!a&&i&&(a=!0,i())}catch(e){console.error("WP Statistics: Error parsing WP_Statistics_Tracker_Object",e),!a&&i&&(a=!0,i())}else++o<20?setTimeout(t,100):!a&&i&&(a=!0,i())},50)},trackUrlChange:function(){var t;this.hasUrlChangeTrackerInitialized||(this.hasUrlChangeTrackerInitialized=!0,t=this,window.removeEventListener("popstate",t.handleUrlChange),history.pushState=function(){t.originalPushState.apply(history,arguments),t.handleUrlChange()},history.replaceState=function(){t.originalReplaceState.apply(history,arguments),t.handleUrlChange()},window.addEventListener("popstate",function(){t.handleUrlChange()}))},handleUrlChange:function(){var t=this;window.location.href!==this.lastUrl&&(this.lastUrl=window.location.href,this.updateTrackerObject(function(){t.checkHitRequestConditions()}))}}),window.WpStatisticsEventTracker||(window.WpStatisticsEventTracker={hasEventsInitializedOnce:!1,downloadTracker:!1,linkTracker:!1,init:(()=>{var t=_asyncToGenerator(_regenerator().m(function t(){return _regenerator().w(function(t){for(;;)switch(t.n){case 0:this.hasEventsInitializedOnce||WP_Statistics_Tracker_Object.isLegacyEventLoaded||(this.hasEventsInitializedOnce=!0,"undefined"!=typeof WP_Statistics_DataPlus_Event_Object&&(this.downloadTracker=WP_Statistics_DataPlus_Event_Object.options.downloadTracker,this.linkTracker=WP_Statistics_DataPlus_Event_Object.options.linkTracker,this.downloadTracker||this.linkTracker)&&this.captureEvent(),window.wp_statistics_event=this.handleCustomEvent.bind(this),"undefined"!=typeof WP_Statistics_Marketing_Event_Object&&this.captureCustomClickEvents());case 1:return t.a(2)}},t,this)}));return function(){return t.apply(this,arguments)}})(),handleCustomEvent:function(t){var e,r=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};t=t,e=WP_Statistics_Tracker_Object.customEventAjaxUrl,n.timestamp=Date.now(),n.resource_id||(n.resource_id=WP_Statistics_Tracker_Object.hitParams.source_id),t={event_name:t,event_data:JSON.stringify(n)},r.sendEventData(t,e)},captureCustomClickEvents:function(){var r=this;WP_Statistics_Marketing_Event_Object.events.clicks.forEach(function(e){!e.selector||null!=e.scope&&e.scope!=WP_Statistics_Tracker_Object.hitParams.source_id||document.querySelectorAll(""+e.selector).forEach(function(t){t.addEventListener("click",function(t){t={text:t.target.textContent,id:t.currentTarget.id,class:t.currentTarget.className,target:t.currentTarget.href},r.handleCustomEvent(e.name,t)})})})},captureEvent:function(){var r=this;document.querySelectorAll("a").forEach(function(t){t.addEventListener("click",(()=>{var e=_asyncToGenerator(_regenerator().m(function t(e){return _regenerator().w(function(t){for(;;)if(0===t.n)return t.a(2,r.handleEvent(e))},t)}));return function(t){return e.apply(this,arguments)}})()),t.addEventListener("mouseup",(()=>{var e=_asyncToGenerator(_regenerator().m(function t(e){return _regenerator().w(function(t){for(;;)if(0===t.n)return t.a(2,r.handleEvent(e))},t)}));return function(t){return e.apply(this,arguments)}})())})},handleEvent:(()=>{var e=_asyncToGenerator(_regenerator().m(function t(e){var r;return _regenerator().w(function(t){for(;;)switch(t.n){case 0:if("mouseup"==e.type&&1!=e.button);else if(e=this.prepareEventData(e),e)return r=WP_Statistics_DataPlus_Event_Object.eventAjaxUrl,t.n=1,this.sendEventData(e,r);t.n=1;break;case 1:return t.a(2)}},t,this)}));return function(t){return e.apply(this,arguments)}})(),prepareEventData:function(t){var e={en:t.type,et:Date.now(),eid:t.currentTarget.id,ec:t.currentTarget.className,ev:"",mb:t.button,fn:"",fx:"",m:"",tu:"",pid:""};return"A"===t.currentTarget.tagName&&(e=this.extractLinkData(t,e)),"undefined"!=typeof WP_Statistics_Tracker_Object&&(e.pid=WP_Statistics_Tracker_Object.hitParams.source_id),e},extractLinkData:function(t,e){var r=t.target.textContent,n=t.currentTarget.href,i=WP_Statistics_DataPlus_Event_Object.fileExtensions,i=new RegExp("\\.("+i.join("|")+")$","i"),r=(r&&(e.ev=r),n&&(e.tu=n),t.currentTarget.classList.contains("woocommerce-MyAccount-downloads-file")||n.includes("download_file="));if(e.wcdl=r,(i.test(n)||r)&&(t=new URL(n).pathname,e.df=r?n.substring(n.lastIndexOf("download_file=")+14).split("&").shift():"",e.dk=r?n.substring(n.lastIndexOf("key=")+4).split("&").shift():"",e.en="file_download",e.fn=r?e.df:t.substring(t.lastIndexOf("/")+1).split(".").shift(),e.fx=r?e.df:t.split(".").pop()),"click"===e.en){if(!this.linkTracker)return!1;try{if(new URL(n).host===window.location.host)return!1}catch(t){}}return!("file_download"===e.en&&!this.downloadTracker)&&e},sendEventData:(()=>{var r=_asyncToGenerator(_regenerator().m(function t(e,r){var n,i,a;return _regenerator().w(function(t){for(;;)switch(t.p=t.n){case 0:for(n in i=new URLSearchParams,e)i.append(n,e[n]);if(r){t.n=1;break}throw new Error("AJAX URL is not defined.");case 1:return t.p=1,t.n=2,fetch(r,{method:"POST",keepalive:!0,body:i});case 2:t.v.ok,t.n=4;break;case 3:t.p=3,a=t.v,console.error("Error:",a);case 4:return t.a(2)}},t,null,[[1,3]])}));return function(t,e){return r.apply(this,arguments)}})()}),document.addEventListener("DOMContentLoaded",function(){var t=WP_Statistics_Tracker_Object.option.consentIntegration.name;t&&"borlabs_cookie"!==t||(WpStatisticsUserTracker.init(),WpStatisticsEventTracker.init()),"wp_consent_api"===t&&handleWpConsentApiIntegration(),"real_cookie_banner"===t&&handleRealCookieBannerIntegration()});