javascript - 跟踪目录产品印象 - 增强型电子商务 Google Analytics

标签 javascript google-analytics e-commerce

我正在尝试使用 google analytics enhanced ecommerce 在电子商务目录页面上实现产品印象跟踪。

按照规范,应该像这样实现它:

ga('create', 'UA-XXXXX-Y');
ga('require', 'ec');

ga('ec:addImpression', {
  'id': 'P12345',                   // Product details are provided in an impressionFieldObject.
  'name': 'Android Warhol T-Shirt',
  'category': 'Apparel/T-Shirts',
  'brand': 'Google',
  'variant': 'black',
  'list': 'Search Results',
  'position': 1                     // 'position' indicates the product position in the list.
});

ga('ec:addImpression', {
  'id': 'P67890',
  'name': 'YouTube Organic T-Shirt',
  'type': 'view',
  'category': 'Apparel/T-Shirts',
  'brand': , 'YouTube',
  'variant': 'gray',
  'list': 'Search Results',
  'position': 2
});

ga('send', 'pageview');              // Send product impressions with initial pageview.

尽管规范显示了跟踪页面浏览事件。为了发送真实的印象,我想在用户向下滚动时触发信标。为此,我通过“延迟加载程序”触发了事件,该加载程序使用事件“ga(发送,印象)”逐渐加载目录中的图像,但它不会起作用,如果我使用其他页面浏览事件执行此操作,我会破坏我在 GA 上的综合浏览量指标。

有没有人知道如何解决这个问题?

最佳答案

来自Enhanced Ecommerce docs :

Note: Ecommerce data can only be sent with an existing hit, for example a pageview or event. If you use ecommerce commands but do not send any hits, or the hit is sent before the ecommerce command then the ecommerce data will not be sent.

non-interactive 发送它事件代替:

ga('发送', '事件', '目录', '印象', {'nonInteraction': true});

关于javascript - 跟踪目录产品印象 - 增强型电子商务 Google Analytics,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25140579/

相关文章:

php - WooCommerce,手动添加产品和购买价格

javascript - 如何在谷歌地图上绘制数百万个点?

google-analytics - Google Analytics(分析)如何影响网站的加载速度?很少的分析工具之间会有冲突吗?

ruby-on-rails - 删除 "powered by spree"页脚

php - 谷歌分析 API : requestReportData by weeks instead of days?

google-analytics - 每个页面加载 gtm.js 都会触发匿名脚本,看起来像是一个 hack

html - 如何从大量 Excel 工作表中删除短语

javascript - 当调用其他 redux 操作创建者时,Redux 表单不会显示在 React Bootstrap Modal 上

将字体从粗体切换为原始字体的javascript按钮

javascript - CSS无限滚动div