本文介绍了GoogleAnalyticsR API-FilterExpression的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用R从Google Analytics(分析)中检索数据

I need to retrieve data from google analytics using R

我使用GoogleAnalyticsR编写以下代码:

I write the following code with GoogleAnalyticsR:

df <- google_analytics(viewId = my_id, 
                     date_range=c(start,end), 
                     metrics = c("pageViews"), 
                     dimensions = "pagePath",
                     anti_sample = TRUE,
                     filtersExpression ="ga:pagePath==RisultatoRicerca?nomeCasa",
                     max=100000)

我需要正确设置FiltersExpression参数.我想从包含RisultatoRicerca?nomeCasa的pagePath中获取数据.这段代码向我返回了一个具有0行的数据框,我知道这是不可能的(每天来自电子商务的数据的交互量超过一万).所以我开始认为我的FiltersExpression不正确.

I need to set correctly the FiltersExpression parameters. I 'd like to have data from pagePath that contains RisultatoRicerca?nomeCasa. This code returns me a dataframe with 0 rows, which i know it's impossible ( data from an e-commerce with more than ten thousand interaction per day). So i 've begun to think that my FiltersExpression is incorrect.

预先感谢

推荐答案

我设法使用filtersExpression解决了问题

I managed to solve the problem using filtersExpression

filtersExpression = "ga:pagePath=@RisultatoRicerca?nomeCasa

此过滤器适用于pagePath维度,并过滤包含RisultatoRicerca的每个路径

this filter works on pagePath dimension and filter every path that contain RisultatoRicerca

这篇关于GoogleAnalyticsR API-FilterExpression的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 17:08