Question

How to tell google syndication not to wait forever to load the ads in case of slow internet connection or otherwise too? Can we fix a time that says okay go and search for 5ms to get ads otherwise don’t delay the load of rest of page.

Was it helpful?

Solution

The YSlow extension for Firebug is great for this sort of thing, it benchmarks your page loading and tells you what's slow, and advises what techniques you can use to improve things.

For example, it gives you advice on where to put your javascript to aid the speed of your site as perceived by the user.

OTHER TIPS

Assuming you mean this is on your site, be sure that your javascript is loaded at the end of the page so your other content can load first

see this blog item "Google Ads Async (asynchronous)" might give you a good starting point for this:

<script type="text/javascript"><!--
// dynamically Load Ads out-of-band
setTimeout((function ()
{
    // placeholder for ads
        var eleAds = document.createElement("ads");  
        // dynamic script element
        var eleScript = document.createElement("script");  
        // remember the implementation of document.write function
        w = document.write;
        // override and replace with our version
        document.write = (function(params)
        {
        // replace our placeholder with real ads
        eleAds.innerHTML = params;
        // put the old implementation back in place
        document.write=w;
        });
        // setup the ads script element
        eleScript.setAttribute("type", "text/javascript");
        eleScript.setAttribute("src", "http://pagead2.googlesyndication.com/pagead/show_ads.js");
        // add the two elements, causing the ads script to run
        document.body.appendChild(eleAds);              
        document.body.appendChild(eleScript);           
}), 1);
                //-->
        </script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top