Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    May 2009
    Thanked 0 Times in 0 Posts

    Google Analytics JS slows site?

    I've noticed that my site has been loading slower lately, especially in google images. I'm thinking that this could be due to the google analytics javascript. I was told that page load slows down if its placed on top (which I have). Is this true? I'm not really warming up to GA but I also don't want to nix it completely. Bottom placement doesn't work for me as GA does not record then.

  2. #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Between DC and Baltimore In a Cave
    Thanked 94 Times in 88 Posts
    You are contacting a 3rd domain and their servers can be slow at times. If it is at the top, your page has to wait until it is resolved and returns data.

    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  3. #3
    Regular Coder
    Join Date
    Nov 2007
    Thanked 9 Times in 9 Posts
    Quote Originally Posted by FlashDriveDT View Post
    Bottom placement doesn't work for me as GA does not record then.
    Yes it does, unless you have frames or something odd that prevents it from tracking correctly.

    However, since the code isn't in the HEAD section of the code, your visitors can move around your site before the GA code has finished executing (thus not tracking). Google actually recommends that you stick the tracking code at the bottom of your page.

    A1ien51 got it right - since you're waiting for a response from the Google server, your loading time is dependent on (1) your visitors internet speed, and (2) Google's current bandwidth. You'll encounter this with any JS-based analytics tool, so if this issue is critical then just install a server log-based application. Google Analytics is far from perfect, but I think it's an awesome tool considering it's free.

    As smart as those people at Google seem to be, I've also noticed that in a lot of their APIs (Analytics, AdSense, and Maps to be specific) they use a gazillion global variables rather than creating a single Google namespace object. While this wouldn't slow anything down, it does lead me to believe that their code isn't engineered as well as it could be or that it simply hasn't been optimized. As a result, the files might be bloated and take longer to download.

    Of course I don't work at Google, so maybe I'm just missing something.

  4. #4
    New to the CF scene
    Join Date
    Jun 2009
    Thanked 0 Times in 0 Posts
    Don't get rid of Google Analytics!! It's such a resourceful tool if you utilize the priceless information provided in the statistics. You can really determine where your advertising money is spent the best. I've always only put GA at the bottom of my webpages and have never had a problem with sites loading because of it. If you have any questions about GA reports/statistics/basic info specifically, don't hesitate to contact me. I'd be happy to help you.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts