8

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?

user46795
  • 2,643
  • 3
  • 25
  • 31

8 Answers8

4

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

Community
  • 1
  • 1
Dan Fabulich
  • 37,506
  • 41
  • 139
  • 175
1

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

Fahim
  • 202
  • 2
  • 12
1

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

nembleton
  • 2,392
  • 1
  • 18
  • 20
1

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
  • 176,543
  • 40
  • 303
  • 368
0

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.

noah
  • 21,289
  • 17
  • 64
  • 88
0

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

JoshBerke
  • 66,142
  • 25
  • 126
  • 164
0

Google is going to make this possible soon...

Adsense for Ajax

Bodman
  • 7,938
  • 3
  • 29
  • 34
0

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.