google 分析 API 中的细分是什么?

What is considered a segment in google analytics API?

我正在查询 google 分析 API 并收到一条错误响应:

Selected dimensions and metrics cannot be queried together.

使用 dimensions-metrics-explorer 我可以找到哪些维度和指标可以一起查询。 https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/

根据浏览器(CM Impressions 和 CM Campaign(CM 模型)),我想要组合的维度和指标应该是可能的

但是,如果我勾选方框 Only show fields that are allowed in segments,那么这两个选项都会消失。所以我假设我在我的请求中使用了分段,但我不明白我是否真的这样做了或者分段是什么。

这些是我查询的部分:

auth: <auth>,
'max-results': 10000,
quotaUser: <quotaUserId>,
metrics: [ 'ga:dcmImpressions' ],
dimensions: [ 'ga:dcmLastEventCampaign', 'ga:date' ],
'start-date': <rangeStart>,
'end-date': <rangeEnd>,
id: [ <analyticsViewIds> ],

我是否使用细分?如果是,细分是什么?

Am I using segments?

不,您正在进行常规查询

what is the segment?

Segments是一个特殊的数据查询功能:

  • 更高级的查询:常规查询在 per-session/hit 级别上工作,只是检查实际的数据行并返回匹配项。使用细分,您可以走得更远:
    • User Scope include data for users who meet certain conditions (regular queries are all session/hit based),从而允许您根据跨会话的标准过滤数据
    • 会话排序 include/exclude 基于用户在会话期间采取的一系列操作的数据(首先是这个,然后是那个,然后立即那个...)
    • Complement cohort 通过使用动态细分和 not 选项,允许您比较互斥的用户细分(例如比较执行目标与不了解是什么让人们转换的用户)
  • UI 和 API
  • 均可用
  • 预定义或动态:您可以在 UI 中创建您的细分并通过其 segmentId or create a dynamic segment via the API directly[从 API 引用它=58=]
  • Sampling might apply so make sure you check for samplingSpaceSizes 查看采样率(如果有的话)

决定是否使用段本身非常简单:

  • 如果你可以在没有段的情况下查询你想要的东西,请不要使用它们
  • 如果您需要它们来查询您想要的内容,请使用它们

具有挑战性的部分是知道您需要查询什么: