Question

How do I add adsense or other ads in a asp.net ajax/ajax based application ? (ex. ra-ajax samples page) or GWT

Is creating an iframe a viable solution?

As stated below, placing adsense script is easy. But the google bot wont be able to scan my ajax based page, as all of the content is javascript. There wont be contextual ads. So wont be able to monetize. It would be great for static ads. Any idea/inputs?

Was it helpful?

Solution

It seems like what you want to do is load up AdSense and then dynamically refresh/change the advertisements based on content delivered via AJAX.

Unfortunately, this is against the AdSense Program Policies; I just posted a long answer about this here: Refresh a Div that has a Google ad inside it

OTHER TIPS

Google recommends against the iframe approach, as it breaks the contextuality of their ads (due to there being no content to work with on the page calling the ad).

Jader, Google AdSense prevents ads from being inserted into the page using AJAX.

Just to add an update to this post, it is now tolerated by the AdSense policies. You can find the updated policy (May 2013) here

Why can't you add the ads normally? You could create an iFrame but I don't see the need.

EDIT: Nevermind. AdSense seems to do everything it can to prevent this from working. They really don't want you to load AdSense dynamically.

I realize this question is a year old, but I've written a library that can help with the document.write part of the problem (whether this is a TOS violation, I don't know) writeCapture.js. It's pretty simple:

$('#ads').writeCapture().html('<script src="whatever-your-adsense-code-is"> </script>');

The example uses jQuery, but you can use it standalone as well. Since it will be loading in the same page (no iframes), it should work pretty well.

Google is going to make this possible soon...

Adsense for Ajax

This is an old question, but just for the record I believe http://www.retailigence.com has an API that you can use for real-time lookup of location and contextual ads.

Google AdSense provides you a small snippet of HTML code, a script tag with some Javascript inside it, that works perfectly with any Web Page, doesn't matters if it is Ajax, ASP.NET, ra-ajax samples page or GWT. If you already inserted this snippet inside your HTML, and still have problems, please provide a link for you page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top