Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-22-2009, 12:14 AM   PM User | #1
FlashDriveDT
New Coder

 
Join Date: May 2009
Location: Germany
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
FlashDriveDT is an unknown quantity at this point
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.
FlashDriveDT is offline   Reply With Quote
Old 06-22-2009, 02:56 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
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.

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 06-23-2009, 02:45 PM   PM User | #3
arthurakay
Regular Coder

 
Join Date: Nov 2007
Location: Chicago
Posts: 134
Thanks: 2
Thanked 9 Times in 9 Posts
arthurakay is an unknown quantity at this point
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.
__________________
Arthur Kay
arthurakay is offline   Reply With Quote
Old 06-23-2009, 05:39 PM   PM User | #4
KellyCodes
New to the CF scene

 
Join Date: Jun 2009
Location: NJ
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
KellyCodes is an unknown quantity at this point
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.
KellyCodes is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:10 PM.


Advertisement
Log in to turn off these ads.