Fun And Games With The Google Analytics Embed API
When I started at Measurelab, way back in July, one of the items on my List Of Things To Do was to look into new and exciting ways of visualising data for clients. A few weeks ago I spent some time experimenting with dc.js but then, Mark and Dara went to MeasureCamp in London (I was going to go but I had other commitments) and came back bearing glad tidings of great joy for all analytics consultants, because unto Google, in the town of Mountain View, was born an API, and the angel Justin Cutroni said to call it Embed.
Why is this so exciting? There are several benefits, both for us and our clients. From our perspective, we get to make “branded” pages with our logo at the top, hosted on our site, which we can track. It also affords greater versatility in visualisation (because it allows you to use third-party stuff as well as the standard Google chart options), and means that we can make it a little neater and cleaner than the old graphs-in-a-spreadsheet arrangement that’s heretofore served us so well. It also lets you view the same charts with different views, and view different views side-by-side.
The dashboards I made were mostly based the ‘pure HTML’ Polymer.js framework from the sixth example page. I was mostly trying to recreate client dashboards, but I threw together a few other things. The construction process is remarkably simple – you can just plug in the various components, adjusting them to your needs, and go. A few modifications are required here and there, but with a little effort (and judicious appropriation of resources from the demo site) you can have something up and running very quickly. An easy-ish guide follows:
(this is for non-experts, if it seems insultingly easy, you probably don’t need it)
Things I Can’t Find Written Anywhere:
- Despite saying it can’t (under ‘possible options’ in the chart.type string here you definitely can use other kinds of charts – f’rinstance, I made a pie chart by setting chart type to PIE, which it doesn’t say you can do but it turns out you can. Experiment, and see what other unlisted chart types are possible!
- As far as I can tell, you can’t have more than 10 widgets on a page. This is a little annoying, because one of the reasons I was so excited about Embed was not having to split client’s dashboards over multiple pages. I can’t find anything about this in the documentation, so I’m not sure exactly what’s going on there.
My To-Do list
- Get third-party visualisations working
- I’m also quite interested to see whether I can pull data from the Management API, because that’s something else that’s been on my R&D research list for a little while (though I haven’t yet had the chance to do it)
Have any of you had a chance to look at the Embed API yet? Maybe butted up against the same 10-widget-on-a-page limit as I did, or have come up with your own novel implementation? Comments and links below would be welcome!