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.dimensions.exclus...

1 line
1.8 KiB
JavaScript

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