放大器实验信息在GA或Google Optimize中不可见 [英] amp-experiment info not visible in GA or Google Optimize
问题描述
我已按照本教程在AMP网站上进行了一个小实验: https://developers.google.com/optimize/devguides/amp-experiments
I've implemented a small experiment on an AMP site following this tutorial: https://developers.google.com/optimize/devguides/amp-experiments
这就是我所做的:
1. amp-analytics和amp-experiment组件
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<script async custom-element="amp-experiment" src="https://cdn.ampproject.org/v0/amp-experiment-0.1.js"></script>
2.实验代码
<amp-experiment>
<script type="application/json">
{
"AMP_Product_Page": {
"sticky": true,
"variants": {
"Original": 50,
"Variant_1": 50
}
}
}
</script>
</amp-experiment>
3.分析代码
<amp-analytics id='analytics1' type='googleanalytics'>
<script type='application/json'>
{
"vars": {
"account": "UA-105350-7"
},
"requests": {
"experiment": "${pageview}&xid=${xid}&xvar=${xvar}"
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "experiment",
"vars": {
"xid": "fB2hAs9HS2WgWqe332c6Ow",
"xvar": "VARIANT(AMP_Product_Page)"
}
}
}
}
</script>
</amp-analytics>
4.在Google Optimize中创建了一个实验
我在Google Optimize中创建了一个实验,并在上面的代码中使用了ID.我还可以在Google Analytics(分析)中看到该实验,但是该实验有0个会话.
I created an experiment in Google Optimize and used the ID in the code above. I can also see the experiment in Google Analytics, it has 0 sessions, though.
我还添加了一些基本的CSS规则,它们工作正常.
I've also added some basic CSS rules and they are working fine.
上面的代码是实时代码,我可以看到该站点上正在运行的实验,<body>
标签也具有属性amp-x-amp_product_page="Variant_1"
.
The code above is live and I can see the experiment running on the site, also the <body>
tag has an attribute amp-x-amp_product_page="Variant_1"
.
Google Analytics(分析)请求
我已经使用GTM AMP容器部署了Google Analytics(分析)集成,并且运行良好.
I have a Google Analytics integration deployed using GTM AMP container and it's working fine.
现在,当我查看Google Analytics(分析)发出的请求时,会看到以下信息:
Now, when I look at the requests made by Google Analytics, here's what I see:
- 浏览量请求(确定)
- 带有实验数据的第二次综合浏览量请求(状态302)
第二个请求似乎没有向GA提出.
That second request seems not to make it to GA.
我尝试通过事件发送实验数据,但是在amp-analytics中似乎不允许xid
和xvar
变量用于事件.
I tried sending experiment data with an event, but it seems like xid
and xvar
are not allowed variables for an event in amp-analytics.
推荐答案
应该对变量进行编号,而不是在中命名.因此,在您的情况下,它们应该是"0"和"1",而不是"Original"和"Variant_1".
Variants should be numbered instead of named in . So in your case they should be "0" and "1" instead of "Original" and "Variant_1".
这篇关于放大器实验信息在GA或Google Optimize中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!