简体   繁体   English

如何根据 Experiment Variant 查询总事件?

[英]How to query Total Events based on Experiment Variant?

I'm looking to query some data from GA through BQ for use in A/B-test analysis.我希望通过 BQ 从 GA 查询一些数据,以用于 A/B 测试分析。

What I'd like to pull out is how many users were placed into each variant, and what was the total amount of add-to-cart completions.我想了解的是每个变体中有多少用户,以及添加到购物车完成的总数是多少。

The following query doesn't quite match up with what I'm seeing in GA (I know there will/can be differences), so I guess I just want to make sure that I've gotten it completely correct.以下查询与我在 GA 中看到的不太匹配(我知道会有/可能存在差异),所以我想我只是想确保我已经完全正确。

The following query very closely matches the 'Unique Events' Metric in GA, but I want to make sure that it's showing me the 'Total Events' Metric:以下查询与 GA 中的“唯一事件”指标非常匹配,但我想确保它向我显示“总事件”指标:

SELECT
  exp_.experimentVariant AS variant,
  COUNT(DISTINCT fullVisitorId) AS users,
  COUNTIF(hits_.eventinfo.eventAction = "add to cart") AS add_to_cart
FROM
  `XXXXX.YYYYY.ga_sessions_*`,
  UNNEST(hits) AS hits_,
  UNNEST(hits_.experiment) AS exp_
WHERE
  exp_.experimentid = "XXXYYYZZZ"
  AND _TABLE_SUFFIX BETWEEN "20220315" AND "20220405"
GROUP BY 
  variant
ORDER BY 
  variant

The reason for why I'm not sure this is quite right is because when I use the following query, the output completely matches the 'Total Events' Metric in GA:我不确定这是否完全正确的原因是,当我使用以下查询时,output 完全匹配 GA 中的“总事件”指标:

SELECT
  COUNT(DISTINCT fullVisitorId) AS users,
  COUNTIF(hits.eventinfo.eventAction = "add to cart") AS add_to_cart
FROM
  `XXXXX.YYYYY.ga_sessions_*`,
  UNNEST(hits) AS hits
WHERE
  _TABLE_SUFFIX BETWEEN "20220315" AND "20220405"

The query will return all users that had a hit with the specified experimentVariant and all add to cart events that had the specified variant sent together with the hit .该查询将返回具有指定 ExperimentVariant 的命中的所有用户,以及具有与命中一起发送的指定变体的所有添加到购物车事件。 In that way it looks correct.这样看起来是正确的。

A user segment in GA of users exposed to the experiment will work differently and return a different result. GA 中暴露于实验的用户细分将不同地工作并返回不同的结果。 The experiment variant users can also have performed add to cart events that didn't have the experiment paramter sent together with them.实验变体用户还可以执行添加到购物车事件,但没有将实验参数与他们一起发送。 For example, the add to cart event could have been sent before the user even became exposed to the experiment.例如,添加到购物车事件可能在用户接触到实验之前就已发送。 If those events are within the timeframe they will be included if the user is qualified for the segment.如果这些事件在时间范围内,如果用户有资格参加该段,它们将被包括在内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM