Originally I had figured to use HtmlService, along with an Html box, and to render the stats information using SVG. The first problem I ran into was that SVG would be stripped out by caja in an html box. Moving on to HTML service, I figured that I could use CANVAS rather than SVG, but soon discovered that I couldn’t dynamically resize the IFRAME gadget that my script would be wrapped in.
I did notice that if I were to write my own gadget I could create a dynamically sized IFRAME (height only unfortunately). This was important because I didn’t want a lot of real estate to be taken up by stats on every page – rather I was after the effect below where hovering would cause the stats to appear and reappear.
Once I got into that, I decided that since I had to introduce a custom gadget anyway, I may as well make it do all the work and pass on web script altogether.
This exercise led to some pretty good snippets.