如何在Google Analytics API V4中使用AND运算符过滤多个维度?

时间:2018-08-07 05:27:49

标签: google-analytics

库:"google/apiclient": "^2.2"
框架:Laravel 5.5

我有一个工作正常的过滤器。但是只有这样才能真正起作用。它将获取所有具有ga:source值的(direct)

$dimensionFilter = new Google_Service_AnalyticsReporting_DimensionFilter();
$dimensionFilter->setDimensionName('ga:source');
$dimensionFilter->setOperator('EXACT');
$dimensionFilter->setExpressions(['(direct)']);

$dimensionFilters[] = $dimensionFilter;

现在,当我尝试使用AND

进行多个过滤时
$dimensionFilter = new Google_Service_AnalyticsReporting_DimensionFilter();
$dimensionFilter->setDimensionName('ga:source');
$dimensionFilter->setOperator('EXACT');
$dimensionFilter->setExpressions(['(direct)']);
$dimensionFilters[] = $dimensionFilter

$dimensionFilter = new Google_Service_AnalyticsReporting_DimensionFilter();
$dimensionFilter->setDimensionName('ga:date');
$dimensionFilter->setOperator('EXACT');
$dimensionFilter->setExpressions(['20180413']);
$dimensionFilters[] = $dimensionFilter;

它仅使用(direct)以及20180413检索全部。它应该只检索1个结果或同时包含(direct)20180413的2个结果。

0 个答案:

没有答案