【发布时间】:2021-11-23 16:30:18
【问题描述】:
我正在尝试将增强型电子商务集成到我的页面中(Google Analytics 似乎可以工作)。问题是 - 在浏览器控制台中我得到没有错误的调试消息,但在 Google Analytics 页面上我什么也看不到。
所以,它看起来像这样:
这段代码我刚刚从documentation复制过来的:
this.$ga.ecommerce.addProduct({
'id': 'P12345', // Product ID (string).
'name': 'Android Warhol T-Shirt', // Product name (string).
'category': 'Apparel', // Product category (string).
'brand': 'Google', // Product brand (string).
'variant': 'Black', // Product variant (string).
'position': 1, // Product position (number).
'dimension1': 'Member' // Custom dimension (string).
});
this.$ga.ecommerce.setAction('click', {
'list': 'Search Results'
});
在 Google Analytics(分析)页面上没有任何内容。从字面上看,除了在线用户和他们访问的页面之外什么都没有,但没有关于增强型电子商务
在 Stack Overflow 上的某个地方,我看到页面上必须只有一个操作,我尝试过,但没有成功。
无论如何,这里是@nuxtjs/google-analytics的配置:
const testingAnalytics = true;
module.exports = {
modules: [
'@nuxtjs/google-analytics',
],
googleAnalytics: {
id: process.env.GA_ID,
dev: testingAnalytics ? true : process.env.NODE_ENV !== 'production',
debug: testingAnalytics
? {
enabled: true,
sendHitTask: true
}
: {},
ecommerce: {
enabled: true,
enhanced: true
}
},
}
如果有人知道如何解决这个问题以及如何让事情发挥作用,我将不胜感激。
【问题讨论】:
标签: google-analytics nuxt.js enhanced-ecommerce