From e201771d4cd6bb56e951b3deda43974479cbd387 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Sun, 30 Mar 2014 16:46:25 +0200 Subject: [PATCH] Do not track pageview etc. on localhost --- _includes/scripts.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/_includes/scripts.html b/_includes/scripts.html index e967c84..9bc63d9 100644 --- a/_includes/scripts.html +++ b/_includes/scripts.html @@ -10,10 +10,12 @@ })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); (function() { - var host = window.location.host; + var host = window.location.hostname; - ga('create', '{{ site.google_analytics }}', host); - ga('send', 'pageview'); + if (host !== 'localhost') { // No tracking on localhost + ga('create', '{{ site.google_analytics }}', host); + ga('send', 'pageview'); + } })(); {% endif %}