Does Chartbeat slow sites down?

June 22nd, 2009 by Tony

A few Chartbeat users have told us that when their sites are loading slowly they see ‘loading ping.chartbeat.net’ hanging in their browser status bar. Their browser seems to be telling them that Chartbeat is slowing down their page load. However, just as with other analytics services like Google Analytics, in most cases the browser isn’t saying that it’s waiting on Chartbeat because it’s loading slowly, but because the code is positioned at the bottom of the page and thus is referenced when any file on the page is loading slowly. Chartbeat code The Chartbeat code is built in Javascript, which, like HTML, is displayed by browsers in the order that it appears on the page. The Chartbeat code is designed to be placed at the very bottom of the page just before the </body> tag. This means that it doesn’t load until the rest of the page has already loaded, so even if there is a problem with Chartbeat (for instance, if there’s DNS issues, network problems, server unavailability or anything else that affects all web services) it doesn’t affect the page. The code is just one line and is hosted on a CDN so that it loads as fast as possible. The ping of ping.chartbeat.net which gives your site the heartbeat that we track is only called after everything else has loaded and each beat is less than 60 milliseconds. So why does my browser say waiting for ping.chartbeat.net? Browsers put priorities on which files need to finish loading before requesting new files. Chartbeat’s code is the last code that the browser requests. If files higher in priority are loading slowly, then the browser waits for those files to load before requesting the chartbeat code. When this happens, some browsers (particularly Firefox) display a message in the status bar saying ‘waiting for ping.chartbeat.net’, but what they really mean is ‘we’re waiting for the current file we’re requesting to finish loading so that we can get down to ping.chartbeat.net and load that’. It’s shorthand that browsers often tell about whatever code happens to be at the bottom of the page. What can I do? If you have concerns about Chartbeat and page load time, the most important thing to check is that the chartbeat code is positioned just before the /body tag. If you are still having problems, please contact us either through our Uservoice page or by emailing us at support@chartbeat.com and we’ll be happy to help.