chopin_is_the_best
chopin_is_the_best

Reputation: 2101

Not able to export more than 1000 rows via googleAnalyticsR

I am using the library to export more than 6 months of data.

The total amount of rows of my export in the interface is around 2000 rows.

When I replicate the report via the package I systematically get 1000 rows.

Is there a way to export the total amount of rows?

My code looks like - simply:

library(googleAnalyticsR)
my_id <- 123456
ga_auth()

df_ga <- google_analytics(my_id, 
                       date_range = c("2018-12-04", "2019-09-04"),
                       metrics = c("sessions"),
                       dimensions = c("transactionId","sourceMedium","deviceCategory",'region',"city","hour","channelGrouping","userType") ) 

Upvotes: 2

Views: 640

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116918

You need to add Max rows in order to request additional rows.

# 1000 rows only
thousand <- google_analytics(ga_id, 
                             date_range = c("2017-01-01", "2017-03-01"), 
                             metrics = "sessions", 
                             dimensions = "date")

# 2000 rows
twothousand <- google_analytics(ga_id, 
                             date_range = c("2017-01-01", "2017-03-01"), 
                             metrics = "sessions", 
                             dimensions = "date",
                             max = 2000)  

# All rows
alldata <- google_analytics(ga_id, 
                             date_range = c("2017-01-01", "2017-03-01"), 
                             metrics = "sessions", 
                             dimensions = "date",
                             max = -1)   

Upvotes: 2

Related Questions