Google Analytics Full Referrer Tracking Update

February 15, 2007 by reuben | Filed under Google, Google Analytics, Tracking.

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.


12 Responses to “Google Analytics Full Referrer Tracking Update”

  1. Yuri says:

    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.

    Reuben

  2. thr0b says:

    Hi,

    Is it still working? Cause I tried but since I’ve added the code, Google Analytics indicates 0 visits :(

  3. reuben says:

    thr0b: Yes it’s still working here. If you have multiple profiles, are you sure you’re pushing data to the right profile?

  4. thr0b says:

    It’s ok now but… I can’t see the full path of the referers. I mean, I just can see alias.domain.com or domain.com but not domain.com/forum/blabla…

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

  5. reuben says:

    thr0b: Depending on which method you’re using, you either need to look in the user defined report, or top content.

  6. Sisupoika says:

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

  7. Derek says:

    I can’t see the code.

  8. Is this still working with the current Google Analytics?

  9. Silvia says:

    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: http://www.logaholic.com/wp/trial-download/

  10. lektire says:

    ohh, that helped me so much, thx bro

  11. Anes says:

    where is the line that returns the URL of the tracking code?