My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
DemoGwtAdsene  
Demo GWT Adsense Integration
Updated Oct 8, 2011 by branflak...@gmail.com

Plan B Due to No Ads Iframing

Since I can't advertise Google in iframe, I setup Affiliate Banner Rotator. More about that here

How I Integrated Adsense

My goal is to integrate Adsense into Java code so I coud draw or render the ad into the area I would like it and when the application state changes like a page loads or reloads I would like to redraw or refresh the ad like a page would.

Reference

IFrame Method

Its easy to do a iframe method for adsense. I load up the page with the script in it and it works fine.

Script Include

I can't seem to get this to work yet b/c ad will erase the page and put it self on it. Google teams need to make for better Adsense integration for Applications!
Below works although has bad side effect.
  public static native void setupAdsenseVars() /*-{
      $wnd.google_ad_client = "ca-pub-0032065764310410";
      $wnd.google_ad_slot = "4089409905";
      $wnd.google_ad_width = 728;
      $wnd.google_ad_height = 90;
  }-*/;

  private void setupAdsenseScript() {
    Document doc = Document.get();
    ScriptElement script = doc.createScriptElement();
    script.setSrc("http://pagead2.googlesyndication.com/pagead/show_ads.js");
    script.setType("text/javascript");
    script.setLang("javascript");
    vpAdsenseScript.getElement().appendChild(script);
  }
Comment by vincenzo...@gmail.com, Jun 22, 2011

cccc

Comment by jeffery...@gmail.com, Aug 23, 2011

Adsense policy now forbids iframe:

"AdSense? code may not be altered, nor may the standard behavior, targeting or delivery of ads be manipulated in any way that is not explicitly permitted by Google. This includes but is not limited to the following: clicking Google ads may not result in a new browser window being launched, nor may Google ads be placed in an IFRAME."

https://www.google.com/adsense/support/bin/answer.py?answer=48182

Can't seem to find a solution to get GWT and Adsense to play together.

Comment by project member branflak...@gmail.com, Oct 8, 2011

Here is Plan B, since I can't use adsense in an Iframe. http://code.google.com/p/gwt-examples/wiki/DemoAdvertisingAffiliate


Sign in to add a comment
Powered by Google Project Hosting