如何在我的 WordPress 网站中配置电子商务跟踪?

问题描述 投票:0回答:1

我想在我的 WordPress 网站中启用电子商务跟踪,该跟踪反映在 Google Analytics 4 中。默认情况下,我已将代码集成到 GA4 的 WordPress 中。但现在还想添加电子商务跟踪。

我该怎么办? 我需要谷歌标签管理器吗? 如果是,现有的 GA4 跟踪代码会发生什么情况?

wordpress e-commerce google-tag-manager google-analytics-4
1个回答
0
投票

您只需为电子商务事件创建数据层。 https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag 例如,产品页面视图数据层代码如下:

gtag("event", "view_item", {
  currency: "USD",
  value: 7.77,
  items: [
    {
      item_id: "SKU_12345",
      item_name: "Stan and Friends Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 2.22,
      index: 0,
      item_brand: "Google",
      item_category: "Apparel",
      item_category2: "Adult",
      item_category3: "Shirts",
      item_category4: "Crew",
      item_category5: "Short sleeve",
      item_list_id: "related_products",
      item_list_name: "Related Products",
      item_variant: "green",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 9.99,
      quantity: 1
    }
  ]
});
© www.soinside.com 2019 - 2024. All rights reserved.