使用ga.js为自定义报告设置自定义维度的正确方法

时间:2019-02-21 15:17:23

标签: google-analytics

我为我的网站创建了一个非常基本的AB测试工具

哪种是正确的尺寸设置方式?网页浏览或设置?

我的浏览量代码

if(control){
    ga('send', 'pageview', {
        'dimension20':  'control'
    });
} else {
    ga('send', 'pageview', {
        'dimension20':  'variation'
    });
}

或设置尺寸

if(control){
    ga('set', 'dimension20', 'control');
} else {
    ga('set', 'dimension20', 'variation');
}

我不确定Google更新数据需要多长时间,但是设置维度似乎无济于事,综合浏览量似乎可以在我的自定义报告中使用,但跳出率却很低,正在发送影响我的跳出的浏览量率?

使用综合浏览量设置自定义维度时,表格最右侧的跳出率,会话位于其左侧。

this prometheus-users thread

3 个答案:

答案 0 :(得分:0)

据我所知,Google Analytics(分析)每天都会更新数据几次,因此您很快就会看到结果。 关于您的问题:通过此代码

ga('send', 'pageview', {
    'dimension20':  'control'
});

您仅通过一次综合浏览量发送此维度 并通过设置

ga('set', 'dimension20', 'control');

您要随每个综合浏览量或事件发送此维度。因此,哪种方法更好取决于您的范围。 您可以尝试使用适用于Chrome的GA Debugger扩展程序,以更好地了解发生了什么。

答案 1 :(得分:0)

如果要使用set,则需要在发送综合浏览量之前使用它,否则,只有在下一次匹配时,维度才能继续传递。

我建议您设置CD,因为它将为您可能在页面上配置的任何其他事件(点击,pdf下载等)设置CD。

答案 2 :(得分:0)

通过设置维度然后发送事件对其进行排序,并将nonInteraction设置为true,以免影响跳出率。

if(control){

    // if bucketed into control, set cookie so they are in control next time they load, also set ga demension that they're in control

    Cookies.set(cookieName, 'control');

    if(!internal){
        ga('set', gaDimension, testName + 'control');
        ga('send', 'event', 'InternalAB', 'ABCustom', {
            nonInteraction: true
        });
    }
} else {
    // if bucketed into variation, set cookie so they are in variation next time they load, also set ga demension that they're in variation and load the test

    Cookies.set(cookieName, 'variation');

    if(!internal){
        ga('set', gaDimension, testName + 'variation');
        ga('send', 'event', 'InternalAB', 'ABCustom', {
            nonInteraction: true
        });
    }
    load_test();
}

enter image description here

相关问题