【问题标题】:Google Analytics: Is there any way to create the Cohort Analysis report using the Analytics API?Google Analytics:有什么方法可以使用 Analytics API 创建队列分析报告?
【发布时间】:2015-08-10 12:56:59
【问题描述】:

无法在维度和指标资源管理器中找到同类群组维度或用户获取日期以将数据输入 Google Script .gs (https://developers.google.com/analytics/devguides/reporting/core/dimsmets)

【问题讨论】:

    标签: analytics google-analytics-api


    【解决方案1】:

    你应该尝试使用dateOfSession<> segment notation:

    segment=users::sequence::^ga:sessionCount==1;dateOfSession<>2014-05-20_2014-05-30;->>ga:sessionDurationBucket>600
    

    上述部分将为您提供在 2014 年 5 月 20 日至 2014 年 5 月 30 日期间进行了首次会话并且在网站上停留时间超过 600 秒的用户。

    2016 年 4 月更新

    截至 2016 年 4 月,随着 Analytics Reporting API V4 的发布,现在可以通过直接查询 API 来创建 cohort 报告:

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

    文档包含各种语言的samples

    注意生命周期值查询("lifetimeValue": True 和所有ga:acquisition... 维度)很重要,如Analytics Help Center 中所述,只能查询App Views

    【讨论】:

    • 很好的答案 - 但是可以将它与谷歌电子表格的插件一起使用吗?
    • 电子表格插件使用 Core Reporting API V3,这意味着您需要使用我在原始答案中描述的 dateOfSession&lt;&gt; 段符号。
    猜你喜欢
    • 2014-05-31
    • 2014-05-03
    • 2012-12-19
    • 1970-01-01
    • 1970-01-01
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多