Adsense on Google Sites


If you have a Google Site and use Adsense you probably saw this  announcement.

Starting October 10, 2013, it will no longer be possible to modify AdSense ad code on Google Sites pages.

It also says this

However, any ads you’ve previously placed on Google Sites will continue to show, and you’ll be credited for all valid earnings.


This method will allow you to include ads on your sites using a gadget mechanism similar to one used for legacy ads still being shown.

On the right you'll see an ad being displayed using a gadget

It uses the new async/non blocking version of the adsense code snippet with the auto sizing capability so should be a little more flexible and faster to load than the previous ad picker gadget.

Note that the policy on Adsense setup forbids the use of Iframes to host ads. This method may be in violation of that since when you add a gadget to site, Sites creates an iFrame to host it in. If so then the same thing applies to Webapps generated by HtmlService. I am  using this technique for demonstration purposes.






Step 1 - create an ad or multiple ads in the my Ads section of your ad sense account


You'll need the ID of the ad unit you want to show. You'll also need the publisher id which you'll find in the account settings of your adsense account. it looks something like ca-pub-xxxxxxxx

Step 2 - insert the gadget by URL where you want the ad to appear.


You'll find it at https://storage.googleapis.com/goinggas.com/public/hosting/sites/xliberation/xml/sitesense.xml


Step 3 - provide parameters to the Gadget


You just need your ad unit ID of the ad format you want to show, and the publisher ID. The width and height doesn't need to match the ad format, but better if it does


And that's it- you'll be displaying ads like the ones below 





For help and more information join our forum,follow the blog or follow me on twitter .


Comments