在Google Analytics(分析)增强型电子商务中跟踪结帐步骤

时间:2018-08-17 21:13:46

标签: google-analytics

我正在尝试使用Google Analytics(分析)跟踪电子商务网站上的步骤,但是由于某种原因,我无法在我的结帐渠道中看到数据。

我有此代码:

$('#button_order_cart').click(function(e){
    var currencyId = currency.iso_code;
    for (var i=0; i < products.length ; i++ ){
        var product = products[i];
        console.log('PRODUUUCT', product);
        if(product.id_product === undefined){
            product.id_product = product.id;
        }
        ga('ec:addProduct', {
            'id': product.id_product,
            'name': product.name,
            'category': product.category,
            'price': product.price,
            'currency': currencyId,
            'quantity': product.quantity
        });

    }
    ga('ec:setAction','checkout', {
        'step': 1,            // A value of 1 indicates this action is first checkout step.
    });

    // Check if we're logged in and automatically send checkout step step number 2.
    if(cart.id_customer !== null && cart.id_customer !== '0'){
        for (var i=0; i < products.length ; i++ ){
            var product = products[i];
            ga('ec:addProduct', {
                'id': product.id_product,
                'name': product.name,
                'category': product.category,
                'price': product.price,
                'currency': currencyId,
                'quantity': product.quantity
            });
        }
        ga('ec:setAction','checkout', {
            'step': 2,           
            'option': 'Logged In'
        });
    }
});

然后在GA调试控制台上,单击按钮时,我会得到以下输出:

VM7378 analytics_debug.js:10 Executing Google Analytics commands.
VM7378 analytics_debug.js:10 Running command: ga("ec:addProduct", {id: 1728, name: "24 Rosas - First Red", category: undefined, price: "Q. 348.00", currency: "GTQ", quantity: 2})
VM7378 analytics_debug.js:10 Executing Google Analytics commands.
VM7378 analytics_debug.js:10 Running command: ga("ec:setAction", "checkout", {step: 1})

如果Google Analytics(分析)调试控制台未抛出任何错误,我不确定为什么我看不到数据。

有人可以帮助我验证我是否采取了正确的行动?

0 个答案:

没有答案
相关问题