Current time: 12-11-2019, 07:16 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Optimizing DFP loading
09-11-2010, 12:18 AM
Post: #1
Optimizing DFP loading
Ive been using DFP (formerly known as Google Ad Manager) to serve ads on my site. I use their Iframe method, where the javascript would write an iframe and allow the third party ad networks to load their ad asyncronously.

But there was still a downside to this.

DFP asks me to put the following code within the <head></head> part of the page :-

Code:
<!-- PUT THIS TAG IN THE head SECTION -->
<script src="http://partner.googleadservices.com/gampad/google_service.js" type="text/javascript"></script>
<script type="text/javascript">
GS_googleAddAdSenseService("ca-pub-xxxxxxxxxxxxxxxx"); // snipped
GS_googleEnableAllServices();
</script>
<script type="text/javascript">
GA_googleUseIframeRendering();
</script>
<!-- END OF TAG FOR head SECTION -->

And the following code to load the ads

Code:
<script type="text/javascript">GA_googleFillSlotWithSize("ca-pub-xxxxxxxxxxxxxxxxxxxxxxx", "slot_name", 728, 90);</script>


The problem with this is that this makes 3 serial requests to google blocking up the page.

What i did was i moved that chunk to the <body> part of the HTML just before the first time i use the GA_googleFillSlotWithSize() function. The results were astonishing!

My final aim is to rewrite the remplate so the adtags(and the bootstrap code) will be below the content, so that shows up instantly.

If you see the before and after waterfall charts youll see after the change, atleast some images were being downloaded in parallel to these DFP javascript scripts. Even visually , the user got some feedback that the page is loading earlier.

So, next time if some third party asks you to put code within the <head> part, think carefully if it really must go in the <head>?

In an ideal world, Google would make DFP tagging absolutely asyncronous so it doesnt get in the way of the user and the content.

cdnplanet.com: We help you select the right CDN
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)