Tuesday, July 3, 2012

AdSense without iframe

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





--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/OxnNegvVBFkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment