title: Google analytics on localhost: Why is my test code not working?
body: <p>I have an html-file and want to add google analytics on it. After registering with ga I got the following tracking code to paste on my html file inside the head right at the beginning. I did that and then went on to my ga profile and there I chose the property and clicked on the "send test traffic" button. Unfortunately ga failed to access my website. </p>
  
  <p>I thought, maybe it is because I'm trying to run the code on a local host. But according to <a href="https://stackoverflow.com/questions/4375447/can-you-test-google-analytics-on-a-localhost-address">Can you test google analytics on a localhost address?</a> a local host is automatically recognised by ga. So I don't know what I'm doing wrong. </p>
  
  <p>When I click on the "send test traffic" button, I get a new window that says "the website can not be accessed". 
  I am using opera and firefox as browsers. got the same problem in both.</p>
  
  <pre><code>&lt;script async src="https://www.googletagmanager.com/gtag/js?id=UA-146066316-1"&gt;&lt;/script&gt;
  &lt;script&gt;
          window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'UA-xxxxxxxx');
  &lt;/script&gt;
  
  
  
  </code></pre>