【发布时间】:2015-06-22 03:04:25
【问题描述】:
我有兴趣使用自定义维度属性来吸引访问者,其中每一行都是唯一的 fullvisitorid,列是所需的 customdimension.values。
以伦敦头盔为例,在这里我用我感兴趣的两个自定义维度来吸引访问者:
SELECT fullvisitorid, customDimensions.index, customDimensions.value
FROM [google.com:analytics-bigquery:LondonCycleHelmet.ga_sessions_20130910]
where customDimensions.index in (2,3)
group by fullvisitorid, customDimensions.index, customDimensions.value
它给出的结果如下:
+---------------+------------------------+------------------------+
| fullvisitorid | customDimensions_index | customDimensions_value |
+---------------+------------------------+------------------------+
| 1 | 2 | Bronze |
| 1 | 3 | Yes |
| 2 | 2 | Bronze |
| 2 | 3 | No |
| 3 | 2 | Bronze |
| 3 | 3 | Yes |
| 4 | 2 | Platinum |
| 4 | 3 | Yes |
+---------------+------------------------+------------------------+
我想要转置的值,其中 customDimension_index 2 是颜色,而 customDimension_value 3 是 yesno,所以结果应该是这样的:
+---------------+----------+-------+
| fullvisitorid | color | yesno |
+---------------+----------+-------+
| 1 | Bronze | Yes |
| 2 | Bronze | No |
| 3 | Bronze | Yes |
| 4 | Platinum | Yes |
+---------------+----------+-------+
我可以单独拉一个然后另一个并加入 fullvisitorid,但希望能够以这种方式一步提取数据。谢谢!
【问题讨论】:
标签: google-analytics google-bigquery