Pregunta

Our app uses the Google Analytics Rest API. We'd like to get the number of page views generated by different links to the site.

For example, one link to our site might be:

http://oursite.com?linknum=12345

and another might be:

http://oursite.com?linknum=23456

We'd like to track the number of page views by all visitors who click on each link, so we need a way to filter by parameter.

So far, we just get the number of page views for all visitors without any filters:

curl 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga:(our id) &metrics=ga:pageviews&start-date=2014-4-26&end-date=2011-12-08&access_token=(our access token)'
¿Fue útil?

Solución

The best way to learn the API is to use the query explorer at http://ga-dev-tools.appspot.com/explorer/

For your analysis, add dimension=ga:pagePath and sort=ga:pageviews.

In addition, you could ask for pages which match a filter expression. For example filter=ga:pagePath=@linknum to only include pages with linknum.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top