views:

1503

answers:

7

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?

A: 

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

JoshBerke
+1  A: 

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).

ceejayoz
A: 

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.

Jader Dias
+2  A: 

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: http://stackoverflow.com/questions/435391/refresh-a-div-that-has-a-google-ad-inside-it#441425

Dan Fabulich
A: 

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

Fahim
A: 

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.

noah
A: 

noh, it does not work at all.

daniel