What you need
It took me a while to find out how to do this, but it’s really simple.Implementing this means that you can track usage of your gadget, whether embedded in a web page, or in a Google doc.
- A Google analytics account
- the XML source of the gadet, for example.
What you need to do
- Add a new domain to your google analytics account. Just make one up – in my case I used roadmapper.com. It doesn’t need to exist, and you dont need to own it. It just needs to look like a real domain.
- Remember the UA-xxxxx-n code that Analytics generates for that domain.
- Think of an imaginary page address – this is what views will get recorded against in your analytics report. Again – it doesn’t need to exist.
- Inject this into your in your XML code
var ga = new _IG_GA(‘UA-10017268-2’);
ga.reportPageview(‘/view/pepadaroadmap’)
- And this in your XML
Require feature=”setprefs” /
Require feature=”com.google.gadgets.analytics” /
You are good to go. Shortly afterwards analytics will start reporting on accesses to you gadget, under the domain and page you settled on.
Bruce