AJAX Evolved: No Proxy Required!

AJAX Evolved: No Proxy Required!

What is AJAX?

Short for Asynchronous JavaScript and XML, it is a term that was created to describe the process of loading components of web pages in the background. This allows the main process that renders the page to continue doing so without having to wait for those components to load. As a result, the page loads much faster and the AJAX loaded components show up as they are loaded.

AJAX and Ad Serving

For a long time AJAX and ad serving were not friends and to some extent that is still true today. Many ad servers still lack the capability to deliver ads asynchronously. I guess you could say that AdvertServe was ahead of its time when we introduced AJAX zone code almost 5 years ago.

AJAX: Evolved

It's Complicated?

If we are being honest, let me admit that our AJAX code has been too complicated or bothersome for many users to implement it. You see, due to some of the advanced techniques that it uses to load non-asynchronous third-party ads in an asynchronous manner we had to make some tough choices. One of those choices was to require that you create a proxy (sort of a tunnel) from your web site back to AdvertServe. That allowed for the AJAX requests to appear to be running on your web site domain, which was necessary to avoid being blocked as a cross-domain request.


Of course, at the time we figured that by now everyone would have a browser with CORS (cross origin resource sharing) support to allow cross-domain requests without a proxy but to our disappointment that is still not true for about 15% of web users.

Random Idea

As luck would have it though, I had a random idea a couple of weeks ago. I wondered what would happen if we made the ad server create the hidden IFRAME tag to load the banners asynchronously instead of having the web site create it. Sort of a server push technique if that makes sense. As I had suspected, that successfully eliminated the cross-domain request and removed the need for the proxy. Best of all, once this new technique was proven and tested it only required a few fairly minor changes to our previous AJAX code.


If you are already using AJAX zone code the process to upgrade is really quite simple. All you need to do is log in to your account, go to the Code Wizard and generate an AJAX zone code for any of your zones. It does not matter which one you choose. If you have a sharp eye you will see that the Header Code is slightly different. You simply need to take that header code that loads libcode3.js (version 3 of our AJAX loading library) and replace the old header code (that loads libcode2.js) with the new version.

AJAX Zone Code

Do not, however, simply just rename the libcode2.js script to libcode3.js in your existing header code though as that will not work!

Make sure to save a copy of the old header code just in case you notice some problems so you can quickly roll back to the old version and be sure to let us know! Of course, we do not expect any problems. Still, it would be negligent not to mention that rolling back is possible if necessary.

No changes need to be made to the zone codes that are placed throughout your page code.

Once you are satisfied that everything is working well with the new AJAX code you can go ahead and remove the proxy to AdvertServe from your web site config, but this is optional and leaving it in place will do no harm.

Not Using AJAX Yet?

Now might be the time for you to switch if you have been on the fence about AJAX or could not deploy it due to the proxy requirement before. There are additional benefits other than making your site load faster. Some search engines, such as Google and Yahoo give a slight ranking boost to sites that load their ads asynchronously.

Closing Thoughts

It is really satisfying to finally figure out a solution to make our AJAX code easy to deploy even if it did take 5 years. The original idea of loading ads asynchronously 5 years ago seemed too crazy to work. In fact, it took about two months of serious hacking, testing, fixing bugs and almost giving up on it several times out of frustration before it came to be. It will be nice to see more customers finally taking advantage of that hard work, so if you have any questions or need any help with switching please contact us and we will be happy to help.

← ISP/Organization Targeting
Magic Banners: Templates →