【问题标题】:Get totals or sum source medium filter, Google Analytics API获取总计或求和源介质过滤器,Google Analytics API
【发布时间】:2021-08-09 06:14:48
【问题描述】:
Post request https://analyticsreporting.googleapis.com/v4/reports:batchGet

    {
  "reportRequests":[
  
  {
    "viewId":"XXXXXX",
    "dateRanges":[
    {
      "startDate":"2021-07-01",
      "endDate":"2021-07-31"
    }, 
    {
      "startDate":"2020-07-01",
      "endDate":"2020-07-31"
    }],
    "metrics":[
    {
      "expression":"ga:sessions"
    }],
    "dimensions": [
    {
      "name":"ga:sourceMedium"
    }],
      "dimensionFilterClauses": [
                {"filters": [
                    {"dimensionName": "ga:sourceMedium",
                        "operator": "EXACT",
                        "expressions": ["google / cpc"]},
                    {"dimensionName": "ga:sourceMedium",
                        "operator": "EXACT",
                        "expressions": ["facebook / cpc"]},
                 ]}
            ]
  }]
}

想要 ga:sourceMedium "google / cpc" 和 "facebook / cpc" 的总/完成总和值的响应。有了这个身体,我得到了一个响应,其中包含每个 ga:sourceMedium 分隔的值。可能吗?

【问题讨论】:

    标签: api google-analytics google-api


    【解决方案1】:

    Google Analytics Reporting API 返回它拥有的数据。所以你请求 ga:sourceMedium 这返回 Combined values of ga:source and ga:medium

    您还请求 ga:sessions 将返回 The total number of sessions.

    因此 api 将返回每个源和媒体组合的总会话数。

    如果您想对它们求和,则需要在本地执行此操作,api 不会为您执行此操作。

    【讨论】:

    • 好的,谢谢。所以不能设置google/cpc+facebook/cpc?
    • 不,一旦记录下来,您就无法更改 Google Analytics 中的数据。
    猜你喜欢
    • 1970-01-01
    • 2013-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-26
    • 1970-01-01
    相关资源
    最近更新 更多