我在订单确认页面上使用 Universal Analytics:
// Create the tracker
ga('create', 'UA-XXXXX-Y');
// Fire off a pageview
ga('send', 'pageview');
// Include the ecommerce plugin
ga('require', 'ecommerce', 'ecommerce.js');
// Initialize the transaction
ga('ecommerce:addTransaction', {
id: '1234abc', // Transaction ID*
affiliation: 'Tech Shirts', // Store Name
revenue: '52.19', // Total
shipping: '10', // Shipping
tax: '3.22' // Tax
});
// Add a few items
ga('ecommerce:addItem', {
id: '1234abc', // Transaction ID*
sku: 'TSHIRT-12A', // Product SKU
name: 'Analytics Wizard', // Product Name*
category: 'Men\'s Shirts', // Product Category
price: '12.99', // Price
quantity: '1' // Quantity
});
ga('ecommerce:addItem', {
id: '1234abc', // Transaction ID*
sku: 'TSHIRT-36B', // Product SKU
name: 'Best Developer', // Product Name*
category: 'Women\'s Shirts', // Product Category
price: '12.99', // Price
quantity: '2' // Quantity
});
// Send off the transaction
ga('ecommerce:send');
出于某种原因,分析团队决定在用户刷新页面时记录两次相同的交易。
鉴于事务 ID 相同,将同一事务记录两次似乎不合逻辑(它显然代表同一事务,为什么要复制它?)。
这是未记录的预期行为吗? GA 团队真的希望每个用户都必须编写代码来防止重复吗?
最佳答案
这是预期的行为。这使您能够发送否定交易以取消购买。您需要修改页面代码以不包括重新加载时的电子商务跟踪。
关于google-analytics - 谷歌分析重复交易,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26697898/