Way to stop Google Analytics counting development work as hits

development-environmentgoogle analytics

I have added the JavaScript that I need to the bottom of my pages so that I can make use of Google Analytics. Only problem is that I am sure that it is counting all my development work as hits. Seeing as I probably see some of those pages a hundred times a day it will really skew my readings. Is there a way to turn it off from a particular IP address or is this something that should be built into my build process so it only gets added when I build for deployment?

Best Answer

I like the simple approach of using javascript. It works anywhere.

<script type="text/javascript">
if (document.location.hostname.search("myproductiondomainname.com") !== -1) {

//google analytics code goes here

}
</script>
Related Topic