analytics/priv/tracker/js/plausible.compat.hash.js
RobertJoonas 199206babc
Dimensions continued (#1847)
* added the first version of dimensions extension

* finished dimensions script extension + updated tracking to use it

* script variants build
2022-04-25 10:56:11 +03:00

1 line
1.2 KiB
JavaScript

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