New Google Analytics Easy Dashboard Library

Wednesday, May 09, 2012 | 10:19 AM

Labels:


Many developers save time by using the Google Analytics API to automate Analytics reporting tasks. For example, you can use the API to create a dashboard to report data across multiple profiles. The Google Analytics App Gallery includes many 3rd party solutions that do this.

What if you want to build something quickly that’s custom-tailored  to your business? You would typically have to spend time learning the API, figuring out how to handle authorization, then deciding how to integrate this data with a visualization library. You could build a custom solution, but it took a lot of effort – until now, thanks to the Google Analytics Easy Dashboard Library.

Four months ago we started a project with a team of University of California Irvine students to simplify all of these steps. As part of this project, together we built the Google Analytics Easy Dashboard Library. This library makes it easy to use the Google Analytics API by distilling the process into three easy steps:

1. Register with Google APIs Console.
2. Copy and paste the JavaScript code.
3. Configure this code to query your data and choose a chart type to visualize it.

So now you can create custom Google Analytics dashboards very quickly, with minimal code.

Here’s a quick example. Say you want to create a line chart plotting visitors and visits for the last 30 days. Besides including the library, the only code required is:

<div id=”chart1”></div>
<script>
var chart1 = new gadash.Chart({
  'type': 'LineChart',
  'divContainer': 'chart1',
  'last-n-days':30,
  'query': {
    'ids': TABLE_ID,
    'metrics': 'ga:visitors,ga:visits,ga:pageviews',
    'dimensions': 'ga:date',
    'sort': 'ga:date'
  },
  'chartOptions': {
    hAxis: {title:'Date'},
    vAxis: {title:'Visits'},
  }
}).render();
</script>

Using the code above will create this chart.



It’s that easy! To find out more about using the Easy Dashboard Library, read our Getting Started guide.

While the current library is very useful, we think we can add more features and make it even easier to use. To reach this goal, we’ve started working with another group of UC Irvine students, this time for three academic quarters. This new project’s main goal will be to further simplify the library. We want the students we’re working with to engage with you and implement your feature requests, if possible. If you use this library, we'd love to hear how you think it can be improved. Feel free to send any feedback to through our new GA-easy-dash-feedback google group.

We hope this library saves you time and helps you get more out of Google Analytics.

Posted by,
Jeetendra Soneja and Nick Mihailovski, Google Analytics API Team