ga:itemQuantity 在 ga_sessions_YYYMMDD 中(大查询)
ga:itemQuantity in ga_sessions_YYYMMDD (Big Query)
我正在尝试使用标准 SQL 复制 GA 数量指标 (ga:itemQuantity) 并查询 GA 导出到 BigQuery 日期分区表 (ga_sessions_YYYYMMDD)。
我尝试了以下方法,但 'quantity' 始终为空:
#standardSQL
SELECT
sum(hit.item.itemQuantity) as quantity
FROM `precise-armor-133520.1500218.ga_sessions_20170801` t
CROSS JOIN
UNNEST(t.hits) AS hit
order by 1 ASC;
其他指标有效并与 GA UI 100% 匹配,所以我假设这不是数据导出问题。例如:
SELECT
sum( totals.totalTransactionRevenue ) as revenue, sum( totals.transactions ) as transactions
FROM `precise-armor-133520.1500218.ga_sessions_201708*` t
CROSS JOIN
UNNEST(t.hits) AS hit
group by `date`
order by `date` asc
这些总数分别与 GA UI 中的收入和交易(指标)相匹配。
GA 指标数量 (ga:itemQuantity) 的标准 SQL 查询是什么?
这个有用吗?
#standardSQL
SELECT
sku,
SUM(qtd) qtd
FROM(
SELECT
ARRAY(SELECT AS STRUCT productSKU sku, productQuantity qtd FROM UNNEST(hits), UNNEST(product) WHERE ecommerceAction.action_type = '6') data
FROM `precise-armor-133520.1500218.ga_sessions_20170801`
),
UNNEST(data)
GROUP BY sku
ORDER BY qtd DESC
LIMIT 1000
不确定您是如何 unnest
产品字段的,也许这可以解决您的问题。
为了在每个日期匹配 GA 的网站 UI 中的 "Quantity",请使用以下标准 SQL:
SELECT
SUM(product.productQuantity)
,`date`
FROM
`precise-armor-133520.1500218.ga_sessions_*`
,UNNEST(hits) AS hits
,UNNEST(hits.product) AS product
WHERE hits.eCommerceAction.action_type = "6"
and _TABLE_SUFFIX between '20170801' and FORMAT_DATE("%Y%m%d", CURRENT_DATE)
group by 2
order by 2 asc
我正在尝试使用标准 SQL 复制 GA 数量指标 (ga:itemQuantity) 并查询 GA 导出到 BigQuery 日期分区表 (ga_sessions_YYYYMMDD)。
我尝试了以下方法,但 'quantity' 始终为空:
#standardSQL
SELECT
sum(hit.item.itemQuantity) as quantity
FROM `precise-armor-133520.1500218.ga_sessions_20170801` t
CROSS JOIN
UNNEST(t.hits) AS hit
order by 1 ASC;
其他指标有效并与 GA UI 100% 匹配,所以我假设这不是数据导出问题。例如:
SELECT
sum( totals.totalTransactionRevenue ) as revenue, sum( totals.transactions ) as transactions
FROM `precise-armor-133520.1500218.ga_sessions_201708*` t
CROSS JOIN
UNNEST(t.hits) AS hit
group by `date`
order by `date` asc
这些总数分别与 GA UI 中的收入和交易(指标)相匹配。
GA 指标数量 (ga:itemQuantity) 的标准 SQL 查询是什么?
这个有用吗?
#standardSQL
SELECT
sku,
SUM(qtd) qtd
FROM(
SELECT
ARRAY(SELECT AS STRUCT productSKU sku, productQuantity qtd FROM UNNEST(hits), UNNEST(product) WHERE ecommerceAction.action_type = '6') data
FROM `precise-armor-133520.1500218.ga_sessions_20170801`
),
UNNEST(data)
GROUP BY sku
ORDER BY qtd DESC
LIMIT 1000
不确定您是如何 unnest
产品字段的,也许这可以解决您的问题。
为了在每个日期匹配 GA 的网站 UI 中的 "Quantity",请使用以下标准 SQL:
SELECT
SUM(product.productQuantity)
,`date`
FROM
`precise-armor-133520.1500218.ga_sessions_*`
,UNNEST(hits) AS hits
,UNNEST(hits.product) AS product
WHERE hits.eCommerceAction.action_type = "6"
and _TABLE_SUFFIX between '20170801' and FORMAT_DATE("%Y%m%d", CURRENT_DATE)
group by 2
order by 2 asc