Google Analytics中的群组分析

时间:2016-05-17 14:45:28

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

我想在谷歌分析中建立自己的同类群组。我可以在指标列表中指定自己的指标吗?默认指标如下:

  • 交易
  • 每位用户的交易
  • 收入
  • 每位用户的收入

如果是,该怎么办?如果不是,那么如何记录这些预定义指标的数据?

1 个答案:

答案 0 :(得分:0)

Analytics Reporting API V4:

您可以使用Analytics Reporting API V4构建群组请求

例如:

POST https://analyticsreporting.googleapis.com/v4/reports:batchGet
{
  "reportRequests":
  [
    {
      "viewId": "XXXX",
      "dimensions":
      [
        {
          "name": "ga:cohort"
        },
        {
          "name": "ga:cohortNthDay"
        }
      ],
      "metrics":
      [
        {
          "expression": "ga:cohortActiveUsers"
        },
        {
           "expression": "ga:transactions"
        }
          ],
      "cohortGroup":
      {
        "cohorts":
        [
          {
            "name": "cohort 1",
            "type": "FIRST_VISIT_DATE",
            "dateRange":
            {
              "startDate": "2015-08-01",
              "endDate": "2015-08-01"
            }
          },
          {
            "name": "cohort 2",
            "type": "FIRST_VISIT_DATE",
            "dateRange":
            {
              "startDate": "2015-07-01",
              "endDate": "2015-07-01"
            }
          }
        ]
      }
    }
  ]
}

See the API explorer for an example

并非所有维度和指标都可以一起查询。例如,您将无法查询ga:transactionsPerUserga:cohortActiveUsers。请参阅Dimensions and metric explorer,了解可以一起查询的维度。