我需要从谷歌分析API导出数据,对于下面的我有错误:
Service
只是提到代码缩进很好,我已经用单行写了所有内容,这种格式更易于查看。
对于这段代码我得到了Single<Something>
如果我将第一个参数更改为:interface Cache {
fun getSomething(): Maybe<Something>
}
interface Service {
fun getSomething(): Single<Something>
}
class Repository (
private val cache: Cache,
private val service: Service
) {
fun getSomething(): Single<Something> {
return cache.getSomething()
.????(feed.getSomething()) //onCompleteTransformToSingle() or similar
}
}
我得到了
ga$getData(5A537372, start.date = "2017-12-01", end.date = "2017-12-10",
metrics = "ga:itemR", dimensions = "ga:productR",
sort = "", filters = "", segment = "", batch = TRUE, walk = TRUE)
第一个参数还有一些其他变体与最后一个参数有相同的错误。
那么,在rga函数代码中从google analytics API输入id的正确方法是什么?
感谢。
答案 0 :(得分:0)
RGoogleAnalytics
就是这样的方式:
require(RGoogleAnalytics)
query.list <- Init(start.date = end_date-(2*7-1),
end.date = end_date,
metrics = "ga:sessions,ga:transactions,ga:goal2Starts,ga:goal5Starts",
dimensions = "ga:date,ga:channelGrouping,ga:source",
max.results = 10000,
table.id = "ga:92449317")
ga.query <- QueryBuilder(query.list)
ga.data <- GetReportData(ga.query, token, split_daywise = T, delay = 5)