核心报表API - 高级过滤器

问题描述 投票:1回答:1

我试图运行与我在Google Analytics网络应用中使用的相同的查询。谷歌分析报告API.

我想要一个高级过滤器来检查 pageviews 对于带有特定文件夹的URLs (夹子),必须 ignore pageviews 有特定来源的(漠视).

我有这个。

{
  "reportRequests":
  [
    {
      "viewId": "xxxx",
      "dateRanges": [{"startDate": "2020-02-01", "endDate": "2020-02-21"}],
      "metrics": [{"expression": "ga:pageviews"}],
      "dimensionFilterClauses": [{"filters": [{"dimensionName": "ga:pagePath","operator": "BEGINS_WITH","expressions": ["/folder/"]}]},{"filters": [{"dimensionName": "ga:source","operator": "!=","expressions": ["ignore"]}]}]
    }
  ]
}

这个... 夹子 部分是可以的。但我不知道如何排除掉这个 漠视.

你能帮助我吗?

google-analytics-api
1个回答
0
投票

我之前已经设置了类似于你想在这里使用的过滤器。

我使用的基本上是以下几种方法的组合。

Dimension Filters:
  ==   Exact match
  !=   Does not match
  =@   Contains substring
  !@   Does not contain substring
  =~   Contains a match for the regular expression
  !~   Does not match regular expression


Combining Filters with “And” and “Or” Operators:
  And   “ ; ”
  Or    “ , “

我有一个Repo,里面有报告请求的示例代码,你可以重复使用,如果这对你有帮助的话。https:/github.comjessfelicianoaggregateGoogleAnalyticsReportingblobmasterobjectQueryWithFilter.js。

我希望这能帮助你,如果你有任何后续问题,请告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.