gpt4 book ai didi

google-analytics - 增强型电子商务仅记录 setAction

转载 作者:行者123 更新时间:2023-12-03 17:12:35 24 4
gpt4 key购买 nike

我目前正在实现 Google Analytics 增强型电子商务。当我在我的开发环境中购买东西时,我会检查我的开发分析购物行为,我只看到所有 session 和带有事务的 session 中的值,但两者之间什么都没有。我的代码如下。在每个 ga('ec') 和 ga('send') 对之前或之后,我有时会触发一个事件以进行正常分析。我的代码有什么问题吗?

// All values are angular expressions that I've
// double triple checked to make sure they give good values
ga('ec:addImpression', 'detail',{
'id': $location.search().tripToken,
'name': $scope.holds[a].value,
'price': $scope.holds[a].price,
'category' : tileDisable
});
ga('send','pageview')
// Next GA fire a bit later
ga('ec:addProduct', 'checkout', {
'id': $location.search().tripToken,
'name': optionType,
'price': $scope.getOptionPrice(optionType),
'quantity': parseInt($scope.baseInfo.total_travelers)
});
ga('send','pageview');
// A bit later
ga('ec:setAction', 'purchase', {
'id': $scope.userData.option_type,
'affiliation': $scope.userData.token,
'revenue': $scope.userData.option_price * $scope.baseInfo.total_travelers
});
ga('send','pageview');

最佳答案

对于常见的印象,您必须删除“细节”

    ga('ec:addImpression' *** REMOVE ,'detail'***,{
'id': $location.search().tripToken,
'name': $scope.holds[a].value,
'price': $scope.holds[a].price,
'category' : tileDisable
});

然后,当单击产品时,您需要添加
    ga('ec:addProduct', {
'id': 'P12345',
'name': 'Android Warhol T-Shirt',
'category': 'Apparel',
'brand': 'Google',
'variant': 'black',
'position': 1
});

ga('ec:setAction', 'click', {list: 'Search Results'});
//Remember to add a (non interaction if you wish) event here in order to send the data to GA
ga('send','event','whatever-value');

最后一步是为详细信息页面添加 clic(添加到购物车):
    ga('ec:addProduct', {
'id': product.id,
'name': product.name,
'category': product.category,
'brand': product.brand,
'variant': product.variant,
'price': product.price,
'quantity': product.qty
});
ga('ec:setAction', 'add');
// Send data using an event again (depends on user interaction)
ga('send', 'event', 'UX', 'click', 'add to cart');

如果您想查看实时示例,请访问 Google 官方演示:
http://enhancedecommerce.appspot.com/

关于google-analytics - 增强型电子商务仅记录 setAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27305688/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com