I just want to add to what's been said so far, it may save a lot of headache, you don't need to wait 24 hour to see if it works, yes the total overview take 24 hour, but in Reporting tab, there is a link on left side to Real-Time result and it will show if anyone currently visiting your site, also I didn't have to set 'cookieDomain': 'none'
for it to work on localhost, my setting is on 'auto'
and it works just fine (I'm using MVC 5), on top of that I've added the script at the end of head tag as google stated in this page:
Paste your snippet (unaltered, in its entirety) into every web page you want to track. Paste it immediately before the closing
</head>
tag.
here is more info on how to check to see if analytics works properly.