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.local.js

1 line
1.2 KiB
JavaScript

!function(){"use strict";var a=window.location,r=window.document,t=window.localStorage,o=r.currentScript,s=o.getAttribute("data-api")||new URL(o.src).origin+"/api/event",w=t&&t.plausible_ignore;function e(t,e){var i,n;window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress||("true"!=w?((i={}).n=t,i.u=a.href,i.d=o.getAttribute("data-domain"),i.r=r.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"))}var i=window.plausible&&window.plausible.q||[];window.plausible=e;for(var n,p=0;p<i.length;p++)e.apply(this,i[p]);function d(){n!==a.pathname&&(n=a.pathname,e("pageview"))}var l,u=window.history;u.pushState&&(l=u.pushState,u.pushState=function(){l.apply(this,arguments),d()},window.addEventListener("popstate",d)),"prerender"===r.visibilityState?r.addEventListener("visibilitychange",function(){n||"visible"!==r.visibilityState||d()}):d()}();