0

Case: Our site has many ads block from different publishers and we have placed them on different regions of our sites homepage. They are mainly banner ads.

Problem: Site loads very slow and takes about 15 - 20 sec on an average.

Is there are any ways to improve the placement of scripts of ads ??

6
  • 2
    Have them load asynchronously.
    – gpojd
    Aug 21, 2015 at 14:56
  • Ok, we have defered all are ads script, but the same problem.
    – echo
    Aug 21, 2015 at 14:57
  • 2
    You could move them into another file called "ads.html" and forget about them. It's a win/win for both you and your users.
    – Pierre
    Aug 21, 2015 at 14:58
  • "defer" and "async" do two different things.
    – gpojd
    Aug 21, 2015 at 14:59
  • 1
    You don't have enough information. You need to look at your network inspector and determine what the problems are. Then address them in order of priority. You probably have a blocking script in your <head> that is responsible for a lot of this issue. Aug 21, 2015 at 15:02

2 Answers 2

0

15-20 is totally unacceptable. Ads are typically included with a JavaScript file (supplied by the ad vendor) which will load the resources for the ad.

If the script takes long to load it will block all other JavaScript on the website because browsers will wait until all scripts are loaded. In this case you can delay loading of the script file either by adding defer or adding the script dynamically with JavaScript. See: How to Append <script></script> in javascript?

If the ad resources take long to load it shouldn't impact other aspects of the site. From a UX perspective make sure the ads don't pop in and move other elements when they are finally loaded. You can do this by making sure their space is already allocated.

You can use the Network/Net tab in Chrome/Firebug to see which resources are loading when and see when the browser is read to run JavaScript etc.

0
  1. Create a queue for the ad scripts.
  2. Process that queue after all of your other operations are completed.
  3. Advertisers want to "appear sooner?" Charge more for priority.

Without code, thats about as specific as I can get. Good question!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.