Search code examples
rgoogle-analyticspageviewsgoogle-query-language

Extracting Google Analytics report for all pages


I'm trying to import data from Google analytic s to R by using rga library and following line.

myresults <-  ga$getData(id, start.date="2015-04-28",
     end.date="2015-05-28", metrics = "ga:exits",start = 1,max = 1000)

Above code works and does extract information specified by query "ga:exits", and I was wondering if there exits a query that would provide a report of page views for every pages.

P.S. I have tried google analytics query explorer.

Sincerely, YJ


Solution

  • What about something like this:

    https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3Axxxxxxxx&start-date=2015-05-01&end-date=2015-06-08&metrics=ga%3Apageviews&dimensions=ga%3ApagePath&sort=-ga%3Apageviews