Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google analytics metrics and dimensions API question

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!

like image 937
Stann Avatar asked Mar 05 '11 16:03

Stann


People also ask

What are dimensions and metrics in Google Analytics?

Dimensions are attributes of your data. For example, the dimension City indicates the city, for example, "Paris" or "New York", from which a session originates. The dimension Page indicates the URL of a page that is viewed. Metrics are quantitative measurements.

What metric dimension combination is not valid in Google Analytics?

The correct answer is Sessions / Bounce Rate. Sessions and Bounce Rate both fall under the Metrics category in Google Analytics. Therefore, Sessions / Bounce Rate is not an accurate answer when looking for a metric-dimension combination.

How do I query custom dimensions in Google Analytics?

Sign in to Google Analytics. Click Admin, and navigate to the property to which you want to add custom dimensions. In the PROPERTY column, click Custom Definitions > Custom Dimensions. Click New Custom Dimension.


1 Answers

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.

like image 116
dana Avatar answered Oct 18 '22 09:10

dana