简体   繁体   English

cxApi.chosenVariation()为同一位用户提供不同的值(使用Google Content Experiments JavaScript API)

[英]cxApi.chosenVariation() gives different values fore the same user (using Google Content Experiments JavaScript API)

I'm trying to create ab testing experiment using Google Content Experiments JavaScript API (according to https://developers.google.com/analytics/devguides/collection/analyticsjs/experiments ). 我正在尝试使用Google Content Experiments JavaScript API(根据https://developers.google.com/analytics/devguides/collection/analyticsjs/experiments )创建Ab测试实验。 I thought user should always see only one experiment, but chooseVariation gives me different values (0 or 1) if I refresh page. 我认为用户应该始终只能看到一个实验,但是如果刷新页面,chooseVariation会给我提供不同的值(0或1)。 It seems it always just randomly choose 0/1 and doesn't remember chosen value. 似乎总是随机选择0/1,而不记得选择的值。

What could cause this problem/behaviour? 什么会导致此问题/行为? (experiment is running) (实验正在运行)

Here is my code (on localhost): 这是我的代码(在本地主机上):

<html>
    <body>
        <script src="//www.google-analytics.com/cx/api.js?experiment=HTuY9pj1SPCOkYUkMz1Tvg"></script>

        <script>
            var g_exp_id = "HTuY9pj1SPCOkYUkMz1Tvg";
            var chosenVariation = cxApi.chooseVariation();
            console.log(chosenVariation); //always gives different values (0 or 1) for the same user (after refreshing the page)
        </script>

    </body>
</html>

Could it be that you're not letting GA to write the cookie values? 可能是您不让GA编写Cookie值吗? That should help GA to remember the experiment variation, picked for user. 这应该有助于GA 记住为用户选择的实验变体。

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

相关问题 同一页面上的Google内容实验和Google Analytics(分析):以正确的顺序添加脚本 - Google Content Experiments and Analytics on same page: Adding scripts in correct order 谷歌分析API的多个实验 - Multiple experiments with google analytics api 相同的功能赋予不同的值 - Same Function Gives Different Values JavaScript在同一台计算机上提供了不同的时区 - Javascript gives different timezone on the same machine 使用Google可视化API的Java Query.setQuery()到Google表格的信息为“缺少请求ID的查询:未定义” - Javascript Query.setQuery() to Google sheets using the Google visualization API gives 'Missing query for request id: undefined" 使用Javascript在同一面板上显示不同的内容。 - Displaying different content on the same panel using Javascript. 使用python从javascript获取相同的元素但不同的值 - fetch same elements but different values from javascript using python 如果使用JavaScript相同的属性值相等,如何突出显示内容? - How to highlight the content if same attribute values are equal using Javascript? 将Google Content Experiments代码添加到Angular 1应用程序的单个页面 - Adding Google Content Experiments code to a single page of Angular 1 application 为什么没有显示Google Analytics内容实验的结果? - Why aren't results from Google Analytics Content Experiments showing?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM