【问题标题】:What variables do I have to introduce in my ecommerce tracking code?我必须在我的电子商务跟踪代码中引入哪些变量?
【发布时间】:2021-03-05 10:31:53
【问题描述】:

我要输入电商追踪码并收集数据,不管我看多少教程,我都只能得到这个:

gtag('event', 'purchase', {
  "transaction_id": "24.031608523954162",
  "affiliation": "Google online store",
  "value": 23.07,
  "currency": "USD",
  "tax": 1.24,
  "shipping": 0,
  "items": [
    {
      "id": "P12345",
      "name": "Android Warhol T-Shirt",
      "list_name": "Search Results",
      "brand": "Google",
      "category": "Apparel/T-Shirts",
      "variant": "Black",
      "list_position": 1,
      "quantity": 2,
      "price": '2.0'
    },
    {
      "id": "P67890",
      "name": "Flame challenge TShirt",
      "list_name": "Search Results",
      "brand": "MyBrand",
      "category": "Apparel/T-Shirts",
      "variant": "Red",
      "list_position": 2,
      "quantity": 1,
      "price": '3.0'
    }
  ]
});

如您所见,在教程中,他们使用发明数据作为示例,但并未说明如何使这些变量在无需手动输入的情况下从站点收集数据。

谁能告诉我如何从我的网站收集这些数据?

谢谢!

【问题讨论】:

    标签: e-commerce analytics tracking


    【解决方案1】:

    我认为您需要使这种动态化,您可以拥有自己的结构,包含您想要的任何字段,例如:

     var purchase_data = {
        send: google_id,
        category: "ecommerce",
        transaction_id: order.transaction_id,
        value: order.value,
        currency: order.currency,
        shipping: order.shipping
    }
    

    然后:

    gtag('event', 'purchase', purchase_data);
    

    【讨论】:

      猜你喜欢
      • 2018-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-22
      • 2018-08-08
      • 1970-01-01
      • 1970-01-01
      • 2014-09-17
      相关资源
      最近更新 更多