Google Analytics(分析)API(v4)-如何获取pagePath或url作为响应?目前仅获得带有页面浏览量的pageTitle

时间:2018-12-11 21:23:10

标签: api google-analytics analytics google-analytics-api

我正在将Google Analytics(分析)代码从版本“ v3”迁移到“ v4”,以下是JSON请求查询。我已经成功获取了DimensionFilterClauses-> expressions字段中指定URL的页面标题和页面视图,但是我没有获取页面路径/ URL。

在“ v3”中,对于完全相同的度量和尺寸,我能够获得页面标题,页面路径/ URL和页面浏览量。

是否需要在下面的查询中添加任何内容,以获取网址信息?

      [ "viewId" => $profileId,
        "dateRanges" => [
            "startDate" => $startDate,
            "endDate" => $endDate
        ],
        "metrics" => [
            "expression" => "ga:pageviews",
        ],
        "dimensions" => [
            "name" => "ga:pagePath",
            "name" => "ga:pageTitle"
        ],
        "dimensionFilterClauses" => [
            'filters' => [
                "dimensionName" => "ga:pagePath",

                "operator" => "IN_LIST",

                "expressions" => ["/one/path1",
                                  "/two/path2"]
            ]
        ],
        "orderBys" => [
                "fieldName" => "ga:pageviews",
                "sortOrder" => "DESCENDING"
        ]
    ];

0 个答案:

没有答案