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

1 line
1.6 KiB
JavaScript

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