google analytics metrics and dimensions API question

Stann picture Stann · Mar 5, 2011 · Viewed 9.7k times · Source

I'm trying to use google analytics API to retrieve some data to build a chart that displays number of visitor per day for current month.

However I'm almost completely lost with metrics and dimensions idea.

if I use ga:visitors metrics - that would only give me a total number of visitors - right? How would I retrieve visitors per each day in a month?

any advice would be greatly appreciated.

Thanks!

Answer

dana picture dana · Mar 5, 2011

I highly recommend using the Data Feed Query Explorer to get your feet wet:

https://ga-dev-tools.appspot.com/query-explorer/

You'll have to login with your Google Account and click the button to grant the application access. But it has a simple UI that lets you build your request. A good starting example might be:

  • dimensions: ga:date
  • metrics: ga:pageviews,ga:visitors

This will give you pageviews and visitors per day, for every day in your date range.

The general idea is that you are building a table of sorts. Metrics are what you are measuring, and Dimensions are what you are grouping the Metrics by.