2

Here's a speed test report:

http://tools.pingdom.com/fpt/#!/q25sGwB65/www.scirra.com

As you can see about half that speed is lost to social buttons. I'm doing some reports on page loading time, and we wish to exclude these from the report but they must be reproducable in Pingdom.

I've tried loading the scripts like this:

$(document).ready(function () {
    setTimeout(function () {
        $.getScript("http://platform.twitter.com/widgets.js");
        $.getScript("http://apis.google.com/js/plusone.js");
    }, 100);
});

But it still counts them. Any one know how to do this?

This is also possibly more important than just report aesthetics, Google page speed in webmaster tools also counts these during loading as far as I can tell, and page speed is used as a factor in rankings so it would be good to be able to hide these loads from Pingdom and Google if possible.

Edit

T.J's suggestion of using window load doesn't make any noticable difference on the reporting either:

$(window).load(function() {
    $.getScript("http://platform.twitter.com/widgets.js");
    $.getScript("http://apis.google.com/js/plusone.js");
});
Tom Gullen
  • 61,249
  • 84
  • 283
  • 456
  • It's interesting (and surprising) that it still counts them when you trigger retrieval with a delay like that. I wonder if it waits for all requests initiated prior to the `window` `load` event firing to finish. (Just to test the theory, you might try loading them from `window` `load`, although I expect that's later than you actually want them to be loaded.) Have you asked the Pingdom folks why that is? – T.J. Crowder Feb 29 '12 at 16:39
  • @T.J.Crowder I've updated question, that doesn't seem to help either – Tom Gullen Feb 29 '12 at 16:47
  • I've also tried some basic obfuscation of the URLs as well incase it's searching for them but that doesn't help either – Tom Gullen Feb 29 '12 at 16:48
  • 1
    We developped a similar tool @work (with French probes, [Performance tool](http://www.monitoring-transactionnel.com/performance)) and I can tell the problem of which request you have to keep or not in page loading time analysis is a tough one. Taking only the OnLoad does not take into account all Ajax requests and can for some sites not mimic fully real UX. For what I can say, i suggest you to add an url parameter that can toggle your scripts on/off if you want to measure your page loading time in conditions you master – Grooveek Feb 29 '12 at 16:48
  • @Grooveek that's a good compromise, thanks for the idea – Tom Gullen Feb 29 '12 at 16:50

2 Answers2

1

Stoyan has some good ideas on how social buttons should implemented asynchronously, this may help you - http://www.phpied.com/social-button-bffs/

Eliminating in from the waterfall is going to be pretty hard as Pingdom will use a browser or proxy of some sort to capture the load information.

Why do you want to eliminate them for the report?

You could use webpagetest.org and just block the URLs

Andy Davies
  • 5,794
  • 2
  • 26
  • 21
  • Thanks for the answer, we want to remove it for 2 reasons, 1 we're running a public page load benchmark comparing us to competitors and we suffer heavily as the social buttons misrepresent our page load time (no other competitors use these social buttons) and we want the benchmark to be easily reproducible, also I suspect Google in it's page load time measurements in webmaster tools also count these loads. As page speed is taken into account as a ranking metric it would be good to eliminate these from the waterfall if possible. – Tom Gullen Mar 02 '12 at 17:09
  • Where's the public page that benchmarks you against you competitors? Looking at the source for your homepage I think Stoyan's async loading mechanisms for social buttons may help you over just including the .js files the way you do now. – Andy Davies Mar 05 '12 at 14:44
  • This is what you actually want - Aarron has taken Stoyan's code and make the buttons load after onload has fired - http://www.aaronpeters.nl/blog/why-loading-third-party-scripts-async-is-not-good-enough – Andy Davies Aug 06 '12 at 18:30
0

We do something like this:

$(function(){
    setTimeout(function(){
        /* load twitter, facebook */
    }, 3000);
});

This tries to make sure that all the essential work to be done on the page is completed before the less important Twitter, FB buttons are loaded.

Not really sure pingdom will not report this though.

Niyaz
  • 53,943
  • 55
  • 151
  • 182