ASP.NET (webforms) 与 Google Website Optimizer 多元测试不兼容吗?
我整个早上都在努力尝试在谷歌网站优化器中进行多变量测试。
我已将页眉/页脚代码复制并粘贴到页面中,并设置了一个基本页面部分,只是为了查看一切正常。
当我尝试验证代码时,它失败了说
"No sections detected on test page
TestSectionName - Unexpected or missing characters - Line: 422 Expected: </noscript>"
愚蠢的是输出显然在那里(我使用了 asp 文字来绕过不对称的 noscript 标记)并且可以在源代码中清楚地看到它,如下所示:
<script>utmx_section("TestSectionName")</script><h1>Buy This Product!</h1></noscript>
我已经尝试禁用/删除网站中现有的谷歌分析代码,以防与它发生冲突,但没有运气。
我认为asp.net框架和这个WSO框架可能存在一些不兼容。我能够使用保存在没有 asp.net/page 内容的原始 html 文件中的完全相同的代码,并使其验证正常。
例如,
<html><head></head><body>
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='xxxxx',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return c.substring(i+n.
length+1,j<0?c.length:j)}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;
d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
</script>
<!-- End of Google Website Optimizer Control Script -->
<script>utmx_section("TestSectionName")</script><h1>Buy This Product!</h1></noscript>
<!-- Google Website Optimizer Tracking Script -->
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
(document.location.protocol=='https:'?'s://ssl':'://www')+
'.google-analytics.com/ga.js"></sc'+'ript>')</script>
<script type="text/javascript">
try {
var gwoTracker=_gat._getTracker("UA-xxxxx-1");
gwoTracker._trackPageview("/xxxxx/test");
}catch(err){}</script>
<!-- End of Google Website Optimizer Tracking Script -->
</body>
</html>
在这一切之后,我想知道是否有
a) 任何使用 ASP.NET 并成功进行多变量测试的人
b) 与 asp.net 中的某些内容已知不兼容
c) 使用 WSO 多变量测试进行编码时已知的“禁忌”
d)我错过了一些非常明显的东西?
I've been stuggling all morning trying to get a multivariate test going in google website optimizer.
I've copy and pasted the header/footer code into the pages, and setup a basic page section just to see that everything is working.
When I try to validate the code its failing saying
"No sections detected on test page
TestSectionName - Unexpected or missing characters - Line: 422 Expected: </noscript>"
The silly thing is that the output is clearly there (I have used an asp literal to get around the asymetric noscript tag) and can clearly see it in the source as follows:
<script>utmx_section("TestSectionName")</script><h1>Buy This Product!</h1></noscript>
I've already tried disabling/removing the existing google analytics code in the site on the off chance that was conflicting with it with no luck.
I think there might be some incompatibility with the asp.net framework and this WSO framework. I was able to use exactly the same code saved into a raw html file with no asp.net/page content and have it validate ok.
e.g.
<html><head></head><body>
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='xxxxx',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return c.substring(i+n.
length+1,j<0?c.length:j)}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;
d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
</script>
<!-- End of Google Website Optimizer Control Script -->
<script>utmx_section("TestSectionName")</script><h1>Buy This Product!</h1></noscript>
<!-- Google Website Optimizer Tracking Script -->
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
(document.location.protocol=='https:'?'s://ssl':'://www')+
'.google-analytics.com/ga.js"></sc'+'ript>')</script>
<script type="text/javascript">
try {
var gwoTracker=_gat._getTracker("UA-xxxxx-1");
gwoTracker._trackPageview("/xxxxx/test");
}catch(err){}</script>
<!-- End of Google Website Optimizer Tracking Script -->
</body>
</html>
After all of this I am wondering if there is
a) anyone out there using asp.net with multivariate testing successfully
b) a known incompatibility with something in asp.net
c) known "donts" when it comes to coding with WSO multivariate testing
d) something really obvious I am missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 ASP.NET 网站上使用了 Google Website Optimizer 多变量测试,没有任何问题。
您是否尝试过将
放在自己的行上?我想我总是把它放在默认部分之后的空行上。
I have used Google Website Optimizer multivariate tests on an ASP.NET website without any problem.
Have you tried putting
</noscript>
on its own line? I think I always put it on a blank line after the default section.