analytics/priv/tracker/js/plausible.compat.local.js
2021-10-21 13:57:30 +02:00

1 line
1.2 KiB
JavaScript

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