Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using google analytics but it would only work for a live,hosted website.

Is there a way to let it work in localhost also.

Or is it possible to convert localhost to a url for example

_hxxx://localhost/xyz to _hxxx://mysite/xyz

Please help.

share|improve this question

migrated from Oct 27 '09 at 0:05

This question came from our site for professional and enthusiast programmers.

I believe you can use a host file on the IIS server and create an entry for whatever domain you want, then point it to .

share|improve this answer

Presumably as your site has no domain (has no "." in it like "localhost") then you will need to set _udn="none".

This way Analytics leaves out the domain portion of it's tracking cookies. Another possible way is to setDomainName("none") in GA.js syntax. This prevents Google trying set a domain= on the cookie's and this way they will not fail.

Must admin i have not done this but it would seem the logical way to approach it. Analytics looks for and expects a domain and so fails when it doesn't get one. Stop it looking for one and it shouldn't fail.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.