Spaces:
Running
Running
Upload script.pageview-props.js.download
Browse files
script.pageview-props.js.download
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
!function(){var o,r=window.location,l=window.document,s=l.currentScript,c=s.getAttribute("data-api")||new URL(s.src).origin+"/api/event",u=s.getAttribute("data-domain");function d(t,e,n){e&&console.warn("Ignoring Event: "+e),n&&n.callback&&n.callback(),"pageview"===t&&(o=!0)}var w=r.href,v={},p=-1,f=!1,h=null,g=0;function n(){var t=l.body||{},e=l.documentElement||{};return Math.max(t.scrollHeight||0,t.offsetHeight||0,t.clientHeight||0,e.scrollHeight||0,e.offsetHeight||0,e.clientHeight||0)}function e(){var t=l.body||{},e=l.documentElement||{},n=window.innerHeight||e.clientHeight||0,e=window.scrollY||e.scrollTop||t.scrollTop||0;return a<=n?a:e+n}function i(){return h?g+(Date.now()-h):g}var a=n(),b=e();function m(){var t=i();!o&&(p<b||3e3<=t)&&(p=b,t={n:"engagement",sd:Math.round(b/a*100),d:u,u:w,p:v,e:t,v:1},h=null,g=0,E(c,t))}function y(){"visible"===l.visibilityState&&l.hasFocus()&&null===h?h=Date.now():"hidden"!==l.visibilityState&&l.hasFocus()||(g=i(),h=null,m())}function S(t,e){var n="pageview"===t;if(/^localhost$|^127(\.[0-9]+){0,2}\.[0-9]+$|^\[::1?\]$/.test(r.hostname)||"file:"===r.protocol)return d(t,"localhost",e);if((window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress)&&!window.__plausible)return d(t,null,e);try{if("true"===window.localStorage.plausible_ignore)return d(t,"localStorage flag",e)}catch(t){}var i={},t=(i.n=t,i.v=1,i.u=r.href,i.d=u,i.r=l.referrer||null,e&&e.meta&&(i.m=JSON.stringify(e.meta)),e&&e.props&&(i.p=e.props),s.getAttributeNames().filter(function(t){return"event-"===t.substring(0,6)})),a=i.p||{};t.forEach(function(t){var e=t.replace("event-",""),t=s.getAttribute(t);a[e]=a[e]||t}),i.p=a,n&&(o=!1,w=i.u,v=i.p,p=-1,g=0,h=Date.now(),f||(l.addEventListener("visibilitychange",y),window.addEventListener("blur",y),window.addEventListener("focus",y),f=!0)),E(c,i,e)}function E(t,e,n){window.fetch&&fetch(t,{method:"POST",headers:{"Content-Type":"text/plain"},keepalive:!0,body:JSON.stringify(e)}).then(function(t){n&&n.callback&&n.callback({status:t.status})})}window.addEventListener("load",function(){a=n();var t=0,e=setInterval(function(){a=n(),15==++t&&clearInterval(e)},200)}),l.addEventListener("scroll",function(){a=n();var t=e();b<t&&(b=t)});var t=window.plausible&&window.plausible.q||[];window.plausible=S;for(var L,H=0;H<t.length;H++)S.apply(this,t[H]);function _(t){t&&L===r.pathname||(t&&f&&(m(),a=n(),b=e()),L=r.pathname,S("pageview"))}function k(){_(!0)}var A,T=window.history;T.pushState&&(A=T.pushState,T.pushState=function(){A.apply(this,arguments),k()},window.addEventListener("popstate",k)),"prerender"===l.visibilityState?l.addEventListener("visibilitychange",function(){L||"visible"!==l.visibilityState||_()}):_(),window.addEventListener("pageshow",function(t){t.persisted&&_()})}();
|