Blocking your own hits on your website is generally speaking a good idea as you won’t behave as your “normal” visitors would ending up in skewed KPIs (e.g. conversion rate)
There are a number of (complicated) ways to block your internal traffic but the solution I’ve ended up using is fairly easy.
How to block internal traffic with a cookie
I use a Google Tag Manager Tag that writes a first party cookie setting a parameter internal=true
when a specific URL (in my case /internal) is called.
This parameter is then saved to a macro that I can call in a trigger and thus making it possible to introduce a blocking trigger for the Google Analytics Tags.
Check out the whole process in this how-to video
The code for Google Tag Manager
<script>
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}
setCookie("internal", true, 36500);
</script>