Exclude loopback addresses from analytics (#55)

pull/62/head
Marshall Bowers 7 years ago committed by GitHub
parent 454feec36e
commit bed7cc1ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -57,7 +57,7 @@
}
function trigger(eventName, options) {
if (/localhost$/.test(window.location.hostname)) return ignore('website is running locally');
if (/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/.test(window.location.hostname)) return ignore('website is running locally');
if (window.location.protocol === 'file:') return ignore('website is running locally');
if (window.document.visibilityState === 'prerender') return ignore('document is prerendering');

@ -62,7 +62,7 @@
}
function trigger(eventName, options) {
if (/localhost$/.test(window.location.hostname)) return ignore('website is running locally');
if (/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/.test(window.location.hostname)) return ignore('website is running locally');
if (window.location.protocol === 'file:') return ignore('website is running locally');
if (window.document.visibilityState === 'prerender') return ignore('document is prerendering');

Loading…
Cancel
Save