关于Google Analytics(分析)设置,为了跟踪从产品列表器到产品详细信息页面的产品点击,Google建议实施以下代码(另请参见https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#product-click):
// Called when a link to a product is clicked.
function onProductClick() {
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'});
// Send click with an event, then send user to product page.
ga('send', 'event', 'UX', 'click', 'Results', {
hitCallback: function() {
document.location = '/product_details?id=P12345';
}
});
}
当前,相关网站的GA事件中的配置中未包含hitCallback。有人知道这是否是强制性的/最佳做法,以避免任何点击未发送到Google Analytics(分析)?当然,我想确保在Google产品中正确注册产品点击次数,并避免丢失数据。
列表器网址示例:https://www.hema.nl/dames/dameskleding/jurken-rokken
相同的问题是针对内部促销点击的。