Google Analytics Full Referrer Tracking Update

Since I wrote about tracking the full referrer in Google Analytics, I had feedback from some people saying that their content management system, forum software, etc doesn’t allow them to modify the HEAD section or BODY tag. Some other people are also hesitant to place the code in the HEAD section incase the Google Analytics servers are slow, causing the page to pause while the tracking code is downloaded from Google. Another drawback to putting the tracking code high up on the page is that you may end up counting partial page downloads.

So to get around these issues here’s an alternative which you can place just before the end BODY tag.

Just replace the XXX’s with your Analytics account code.

Update: I’ve augmented the tracking code to also detect if the page is served in http or https mode to serve the appropriate call to the urchin.js file, and also detecting whether the referrer is internal or external so you don’t get your site appearing as a full referrer in the Top Content Report. View my Ultimate Google Analytics Tracking Code.

About reuben 109 Articles
SEO consultant from Columbus OH.


  1. How to log the right ip if my application server is behind an apache proxy? I get the ip of the proxy in Google Analytics instead of the client ip, so the host statistics are wrong…

    Hi Yuri

    I don’t think it’s possible, you may want to try asking in google groups.


  2. It’s ok now but… I can’t see the full path of the referers. I mean, I just can see or but not…

    Is it because I’m stupid and I don’t go in the godd section in Analytics? :P Thank you ;)

  3. Hi, thank you for your suggestion but I was wondering, won’t this affect the page views stat by recording twice one page view?

  4. Hi there! Thanks for the workaround!I just want to point out that you can avoid all this if you use a web analytics solution that supports both Java script and log file tracking. One such solution is Logaholic Web Analytics and it really does wonders with segmentation and tracking. You can download a free trial from:

Comments are closed.