Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

migrated from stackoverflow.com Oct 27 '09 at 0:05

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

2 Answers

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
add comment

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 127.0.0.1 .

share|improve this answer
add comment

Your Answer

 
discard

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