如何使用 PHP 与 Google Analytics Data API (GA4) 结合使用多个过滤器
P粉704196697
P粉704196697 2023-11-04 14:39:38
[PHP讨论组]

所以这是我的第一个问题,我会尽力遵守社区规则。 我正在尝试使用 PHP 在 Google Analytics Data API (GA4) 中使用多个过滤器。我已经成功地能够使用一个过滤器并将其显示在自定义仪表板中。

下面是获取以值开头的 url 数据的代码:/133。 问题是,如何制作一个过滤器来获取多个网址。也就是说,我希望页面的数据以值“/133”、“/88”、“/678”和“/67”开头?

$response = $client->runReport([
    'property' => 'properties/' . $property_id,
    'dateRanges' => [
        new DateRange([
            'start_date' => '2022-01-01',
            'end_date' => 'today',
        ]),
    ],
    'dimensions' => [
        new Dimension(['name' => 'pageTitle',]),
        new Dimension(['name' => 'fullPageUrl',]),
    ],
    'metrics' => [
        new Metric(['name' => 'screenPageViews',]),
        new Metric(['name' => 'activeUsers',]),
        new Metric(['name' => 'newUsers',]),
        new Metric(['name' => 'userEngagementDuration',]),
    ],
    'dimensionFilter' => new FilterExpression([
        'filter' => new Filter([
            'field_name' => 'pagePath',
            'string_filter' => new FilterStringFilter([
                'match_type' => FilterStringFilterMatchType::BEGINS_WITH,
                'value' => '/133',
            ])
        ]),
    ]),
]);


P粉704196697
P粉704196697

全部回复(2)
P粉627110304

来啦

https://jiameng.baidu.com/searchContentList?query=%E7%8E%AF%E7%90%83%E5%85%AC%E5%8F%B8%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%E3%80%90%E5%BE%AE%E4%BF%A1sr88861%E3%80%91https://jiameng.baidu.com/searchContentList?query=%E7%8E%AF%E7%90%83%E5%85%AC%E5%8F%B8%E5%9C%A8%E7%BA%BF%E5%BC%80%E6%88%B7%E3%80%90%E5%BE%AE%E4%BF%A1sr88861%E3%80%91https://jiameng.baidu.com/searchContentList?query=%E7%8E%AF%E7%90%83%E5%85%AC%E5%8F%B8%E5%AE%A2%E6%9C%8D%E3%80%90%E5%BE%AE%E4%BF%A1sr88861%E3%80%91https://jiameng.baidu.com/searchContentList?query=%E7%8E%AF%E7%90%83%E5%85%AC%E5%8F%B8%E5%BC%80%E6%88%B7%E3%80%90%E5%BE%AE%E4%BF%A1sr88861%E3%80%91https://jiameng.baidu.com/searchContentList?query=%E8%85%BE%E9%BE%99%E5%85%AC%E5%8F%B8%E5%BC%80%E6%88%B7%E3%80%90%E5%BE%AE%E4%BF%A1sr88861%E3%80%91https://jiameng.baidu.com/searchContentList?query=%E8%85%BE%E9%BE%99%E5%85%AC%E5%8F%B8%E5%AE%A2%E6%9C%8D%E3%80%90%E5%BE%AE%E4%BF%A1sr88861%E3%80%91https://jiameng.baidu.com/searchContentList?query=%E8%85%BE%E9%BE%99%E5%85%AC%E5%8F%B8%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%9C%8D%E3%80%90%E5%BE%AE%E4%BF%A1sr88861%E3%80%91https://jiameng.baidu.com/searchContentList?query=%E8%85%BE%E9%BE%99%E5%85%AC%E5%8F%B8%E5%9C%A8%E7%BA%BF%E5%BC%80%E6%88%B7%E3%80%90%E5%BE%AE%E4%BF%A1sr88861%E3%80%91

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号