我正在尝试使用RGoogleAnalytics包通过R中的Reporting Core API V3获取Google Analytics的数据。
我希望在两个不同的特定页面路径中获取顺序的用户。为此,我使用正则表达式:
filters_pre = paste0('ga:dimension15==',server_ab_test,';ga:hostname==',site_type)
filters_pre_category=paste0(filters_pre,';ga:users::sequence::ga:pagePath=~(^/$);->>ga:pagePath=~(^/eyeglasses-collection)')
query.init <- Init(start.date = start_date,
end.date = end_date,
dimensions = "ga:date,ga:dimension15",
metrics = "ga:sessions,ga:users,ga:pageviews",
filters = as.character(filters_pre_category),
max.results = 10000,
sort = '-ga:date',
table.id = 'ga:XXXXXXXXXX')
query <- QueryBuilder(query.init)
dt_aux <- GetReportData(query, token, split_daywise = T,delay = 5)
结果我得到了
Error in ParseDataFeedJSON(GA.Data) :
code : 400 Reason : Invalid value 'ga:dimension15==react cart turned on;ga:hostname==www.test1.com;ga:users::sequence::ga:pagePath=~(^/$);->>ga:pagePath=~(^/eyeglasses-collection)' for filters parameter.
有人知道如何使用序列来过滤结果吗?
答案 0 :(得分:1)
您的过滤器(Invalid value [...] for filters parameter
)似乎存在问题,其中包含段条件(ga:users::sequence
):
https://developers.google.com/analytics/devguides/reporting/core/v3/segments#sequences
因此,要么将细分条件移动到细分参数或将其删除,要么不要在过滤器中包含细分条件:
https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters