代码:
library(httr)
library(RGoogleAnalytics)
client.id <- "xxxxxxxxx-hcayyyyyyyyvvoc8.apps.googleusercontent.com"
client.secret <- "dKlQgadfrghhdwfIRf1YO"
token <- Auth(client.id, client.secret)
query.evlist_2018 <- Init(start.date = "2018-07-20",
end.date = "2018-07-23",
dimensions = "ga:date,ga:eventAction",
metrics = "ga:totalEvents",
filters = "ga:eventAction==【三】yahoo",
max.results = 90000,
table.id = "ga:ffffffff")
ga.evquery_2018 <- QueryBuilder(query.evlist_2018)
ga.evdata_2018 <- GetReportData(ga.evquery_2018,token,split_daywise = T)
如果我不使用过滤器,则可以获取所有数据。如果我使用过滤器,并且过滤器仅包含字母,那么它也可以工作。
filters = "ga:eventAction==Click" (O)
如果使用过滤器,并且过滤器不仅包含字母,还会出错。当我的朋友运行此代码时,她可以运行它而没有任何错误,但是当我运行它时,就会发生错误。我在Query Feed Explorer上尝试过,没有问题。不知道为什么它不能在R中运行。
filters = "ga:eventAction==【三】yahoo" (X)
Error in column.param[, 1] : subscript out of bounds
In addition: Warning messages:
1: In GetDataFeed(query.uri, caching.dir = query.builder$caching.dir, :
Your query matched 0 results. Please verify your query using the Query Feed Explorer and re-run it.
如何解决此问题? TIA