AdSense without iframe

302 views
Skip to first unread message

Kulnor

unread,
Jul 3, 2012, 9:14:39 PM7/3/12
to google-we...@googlegroups.com
I've been looking for an easy way to include an AdSense DIV in my GWT app without using an iframe and my current approach is as follows:

(1) In the application host page (i.e. application.html), I include the standard adsense boiler code and put a @id on the wrapping div like:

<div id="adsense">
<script type="text/javascript"><!--
google_ad_client = "xx-xxx-xxxxxxxxxxxxxxxx";
/* OpenDDI 468x60 */
google_ad_slot = "xxxxxxxxxx";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>    

(2) To integrate this as a Widget in the GWT application (for example in the header), I rewrap it in an HTML widget that I can then position/control at will:

Element adsense = RootPanel.get("adsense").getElement();
HTML adsenseWrapper = HTML.wrap(adsense);


Can someone feedback on

  • whether this complies with Google policies (as it is not wrapped in an iframe and essentially loads when the application page loads)?
  • would there be any way to rotate the app by calling the embedded javascript (likewise in compliance with policies)? 

thanks

*K





Reply all
Reply to author
Forward
0 new messages