GoogleAnalyticsR api - FilterExpression

2019-08-02 18:56发布

I need to retrieve data from google analytics using R

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)

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.

Thanks in advance

1条回答
做个烂人
2楼-- · 2019-08-02 19:26

I managed to solve the problem using filtersExpression

filtersExpression = "ga:pagePath=@RisultatoRicerca?nomeCasa

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

查看更多
登录 后发表回答