A better way to load ads scripts so don't compromise the general load (or?)

Started by distante, February 15, 2012, 01:09:13 PM

Previous topic - Next topic

distante

I'm my way to trying to do my site faster, I find out that ad scripts are one of the most important causes of the delay in the charge of a site.

Since many site lived from ads, remove them isn't an option.

I'm thinking in use iframes to load them, in this way:


  • MAINSITE-> [Iframe to load.html]
  • Load.html [contains refresh meta tag to ad.html with 2 to 4 seg]
  • ad.html [have the ad script]

So far (I think) is good Idea, BUT, I found this article : http://www.stevesouders.com/blog/2009/06/03/using-iframes-sparingly/ where this graphic is showed:

Time To Create 100 elements


Since I'm not familiarized with DOM, I'm not quite sure if the Iframe is a good solution anymore....

Opinions?  ::)

distante


MrPhil

I'm no expert on this, but I could see an iframe being slower than in-line ad code, simply because the browser is being told to go out and load another page to populate the iframe. There's extra overhead in doing that.

That said, if a third-party site is slow to serve up content for the ad, I don't think it's going to make much difference if your page has to wait for the content anyway. Your only hope (other than only carrying ads from sites that load fast) may be to rewrite the ad code so that it asynchronously preloads the ad content. Javascript to do display of multiple large images (to be displayed one at a time) does something along these lines -- it brings up the page (with the first image) and while it's waiting for the visitor to perform some action (such as select a picture or ad to view), it is busy loading  the other images to (possibly) be viewed later. Perhaps something like that can be done for your ads: to load some placeholder first and while the visitor is staring at the screen, be loading the other ad content. Then you can rotate in the ad once it's fully loaded.

distante

The asynchronously load was my first idea (like the facebook sdk), but one of rules in the TOS is to not touch the script.

In the other hand, if the ad don't charge until the user scroll, then if he don't scroll that will be "money lost" =\

Advertisement: