You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
analytics/priv/tracker/js/plausible.compat.local.js

1 line
1.2 KiB
JavaScript

!function(){"use strict";var t,e,i,n,a=window.location,o=window.document,r=o.getElementById("plausible"),s=r.getAttribute("data-api")||(t=r.src.split("/"),e=t[0],i=t[2],e+"//"+i+"/api/event"),l=window.localStorage.plausible_ignore;function p(t,e){var i,n;window.phantom||window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress||("true"!=l?((i={}).n=t,i.u=a.href,i.d=r.getAttribute("data-domain"),i.r=o.referrer||null,i.w=window.innerWidth,e&&e.meta&&(i.m=JSON.stringify(e.meta)),e&&e.props&&(i.p=JSON.stringify(e.props)),(n=new XMLHttpRequest).open("POST",s,!0),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(i)),n.onreadystatechange=function(){4==n.readyState&&e&&e.callback&&e.callback()}):console.warn("Ignoring Event: localStorage flag"))}function w(){n!==a.pathname&&(n=a.pathname,p("pageview"))}var d,u=window.history;u.pushState&&(d=u.pushState,u.pushState=function(){d.apply(this,arguments),w()},window.addEventListener("popstate",w));var c=window.plausible&&window.plausible.q||[];window.plausible=p;for(var g=0;g<c.length;g++)p.apply(this,c[g]);"prerender"===o.visibilityState?o.addEventListener("visibilitychange",function(){n||"visible"!==o.visibilityState||w()}):w()}();