以下是在电子商务上执行的 Google Analytics JavaScript 代码(使用GA Debug捕获),用于非常简单的购买过程。
1) 导航到主页
ga("create", "UA-NNNNNNN-1", "auto")
ga("require", "ec")
ga("require", "ec")
ga("require", "ec")
ga("set", "&cu", "EUR")
ga("ec:addImpression", {id: "488", name: "Light Coral", list: "Home Page list", category: "Some/Category/Path", price: "4.50", brand: "Coral", position: 1})
ga("ec:addImpression", {id: "487", name: "Light Purple", list: "Home Page list", category: "Some/Category/Path", price: "4.50", brand: "Purple", position: 2})
ga("ec:addImpression", {id: "489", name: "Light Pink", list: "Home Page list", category: "Some/Category/Path", price: "4.50", brand: "Pink", position: 3})
ga("ec:addImpression", {id: "491", name: "Light Red", list: "Home Page list", category: "Some/Category/Path", price: "4.50", brand: "Red", position: 4})
ga("ec:addImpression", {id: "717", name: "Light Blue", list: "Home Page list", category: "Some/Category/Path", price: "6.00", brand: "Blue", position: 5})
ga("ec:addImpression", {id: "768", name: "Light Pink 2", list: "Home Page list", category: "Some/Category/Path", price: "8.00", brand: "Pink", position: 6})
ga("ec:addImpression", {id: "92", name: "Light Green", list: "Home Page list", category: "Some/Category/Path", price: "5.95", brand: "Green", position: 7})
ga("ec:addImpression", {id: "712", name: "Light Orange", list: "Home Page list", category: "Some/Category/Path", price: "6.50", brand: "Orange", position: 8})
ga("send", "pageview")
2)点击一个产品(在主页上)>打开产品页面
ga("ec:addProduct", {id: "717", name: "Light Blue", category: "Some/Category/Path", price: "6.00", brand: "Blue", position: 5})
ga("ec:setAction", "click", {list: "Home Page list"})
ga("send", "event", "UX", "click", "Home Page list")
ga("create", "UA-NNNNNNNN-1", "auto")
ga("require", "ec")
ga("require", "ec")
ga("require", "ec")
ga("require", "ec")
ga("require", "ec")
ga("set", "&cu", "EUR")
ga("ec:addProduct", {id: "717", name: "Light Blue", brand: "Blue", category: "Some/Category/Path", price: "6"})
ga("ec:setAction", "detail")
ga("send", "pageview")
3) 将产品加入购物车
ga("ec:addProduct", {id: "717", name: "Light Blue", brand: "Blue", category: "Some/Category/Path", price: "6", quantity: "1"})
ga("ec:setAction", "add")
ga("send", "event", "UX", "click", "Add to cart")
4) 转到结帐页面
ga("create", "UA-NNNNNNNN-1", "auto")
ga("require", "ec")
ga("require", "ec")
ga("require", "ec")
ga("set", "&cu", "EUR")
ga("ec:addProduct", {id: "717", name: "Light Blue", price: "6.00", brand: "Blue", category: "Some/Category/Path", quantity: 1})
ga("ec:setAction", "checkout", {step: 1})
ga("send", "pageview")
5)按照结帐流程
ga("ec:addProduct", {id: "717", name: "Light Blue", price: "6.00", brand: "Blue", category: "Some/Category/Path", quantity: 1})
ga("ec:setAction", "checkout", {step: 2})
ga("send", "pageview")
ga("ec:addProduct", {id: "717", name: "Light Blue", price: "6.00", brand: "Blue", category: "Some/Category/Path", quantity: 1})
ga("ec:setAction", "checkout", {step: 3})
ga("send", "pageview")
ga("ec:setAction", "checkout_option", {step: 3, option: "Send to another address"})
ga("send", "event", "Checkout", "Option")
ga("ec:addProduct", {id: "717", name: "Light Blue", price: "6.00", brand: "Blue", category: "Some/Category/Path", quantity: 1})
ga("ec:setAction", "checkout", {step: 4})
ga("send", "pageview")
ga("ec:setAction", "checkout_option", {step: 4, option: "BRT"})
ga("send", "event", "Checkout", "Option")
ga("ec:addProduct", {id: "717", name: "Light Blue", price: "6.00", brand: "Blue", category: "Some/Category/Path", quantity: 1})
ga("ec:setAction", "checkout", {step: 5})
ga("send", "pageview")
ga("ec:setAction", "checkout_option", {step: 5, option: "banktransfer"})
ga("send", "event", "Checkout", "Option")
ga("ec:addProduct", {id: "717", name: "Light Blue", price: "6.00", brand: "Blue", category: "Some/Category/Path", quantity: 1})
ga("ec:setAction", "checkout", {step: 6})
ga("send", "pageview")
6) 结束购买
ga("create", "UA-NNNNNNNN-1", "auto")
ga("require", "ec")
ga("require", "ec")
ga("require", "ec")
ga("require", "ec")
ga("set", "&cu", "EUR")
ga("ec:addProduct", {id: "717", name: "Light Blue", price: "6.00", brand: "Blue", category: "Some/Category/Path", quantity: 1})
ga("ec:setAction", "purchase", {id: "16O00000011", revenue: "16.00", shipping: "10.00"})
ga("send", "pageview")
问题
在 Google Analytics(分析)仪表板的电子商务部分中,当我进入产品性能卡(产品性能 > 产品名称 > 产品 SKU)时,我在产品类别(not set)
下有一个值:
在概览 > 产品类别中,我可以看到产品的正确产品类别:
此外,如果我继续Product Performance,选择Primary Dimension: Product Category (Enhanced Ecommerce),然后单击类别,我可以在此表中看到产品。
我究竟做错了什么?
为什么在产品性能卡里面是 Product Category not set
?