我在R version 1.1.442
中运行此代码时没有任何错误,但在新版本1.1.453
中,此代码会抛出多个错误,例如Error in init
和error in get report data
。新版本library(RGoogleAnalytics)
也被RGoogleAnalyticsPremium
library(RGoogleAnalytics)
library(RGA)
library(RCurl)
client.id="xxxxxxxx-ts4sbtvss5bm1dv6864i8jtkng4tqmtp.apps.googleusercontent.com"
client.secret="xxxxxxx"
token<-Auth(client.id,client.secret)
save(token,file="./token_file")
ValidateToken(token)
query.list <- Init(start.date = "2018-05-01",
end.date = "2018-05-05",
dimensions = c("ga:dimension32","ga:sourcemedium","ga:eventCategory","ga:eventAction"),
metrics = c("ga:sessions","ga:goal6Completions","ga:users"),
max.results = 20000,
sort = "ga:sessions",
filters=c("ga:sourcemedium=~organic;ga:eventCategory=~page_navigation,ga:eventAction=~submitted_crf"),
table.id = "ga:169730504")
ga.query <- QueryBuilder(query.list)
ga.data <- GetReportData(ga.query, token,paginate_query = T)
任何帮助将不胜感激
答案 0 :(得分:0)
新库中没有 max.results = 20000 和 table.id =“ ga:169730504” ,删除它们后应该可以使用。然后使用GetFile而不是GetReportData。我还没有成功获得这些数据,如果成功,请与我分享您的代码。