【问题标题】:How to order in google analytics v4?如何在谷歌分析 v4 中订购?
【发布时间】:2021-04-21 15:40:27
【问题描述】:

我正在尝试按日期运行此查询顺序,默认值是按屏幕视图排序的,这使得图表很奇怪。所以我正在尝试按日期对其进行排序。

let rst = await analytics.runReport({
  property: `properties/${property}`,
  dateRanges: [{
    startDate: '30daysAgo',
    endDate: 'today'
  }],
  dimensions:[
    {
      name: 'date'
    }
  ],
  metrics:[
    {
      name: 'screenPageViews'
    }
  ],
        orderBys:[
            {
                fieldName: 'date'
            }
        ]
});

但我收到以下错误

错误:3 INVALID_ARGUMENT:字段存在于 OrderBy 中,但未在输入维度/指标列表中定义

任何帮助都会很棒。

【问题讨论】:

  • 你检查过文档Google analytics data api它没有提到任何关于order by的内容。
  • 谢谢,但我找到了答案。

标签: node.js google-api google-analytics-data-api


【解决方案1】:

答案:

rst = await analytics.runReport({
  property: `properties/${property}`,
  dateRanges: [{
    startDate: '30daysAgo',
    endDate: 'today'
  }],
  dimensions:[
    {
      name: 'date'
    }
  ],
  metrics:[
    {
      name: 'screenPageViews'
    }
  ],
        orderBys:[
            {dimension:{
                    dimensionName: 'date'
                } 
            }
        ]
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多