วัดอีคอมเมิร์ซ

คุณสามารถตั้งค่าเหตุการณ์อีคอมเมิร์ซเพื่อเก็บรวบรวมข้อมูลเกี่ยวกับพฤติกรรมการช็อปปิ้งของผู้ใช้ เหตุการณ์ช่วยให้คุณวัดปริมาณผลิตภัณฑ์ยอดนิยมและดูอิทธิพลของโปรโมชันและโฆษณาแฝงที่มีต่อรายได้

เอกสารนี้อธิบายเหตุการณ์อีคอมเมิร์ซแต่ละรายการและเวลาที่ควรตั้งค่าเหตุการณ์ ดูตัวอย่างแบบทีละขั้นตอนเกี่ยวกับวิธีตั้งค่าเหตุการณ์อีคอมเมิร์ซได้ที่ตั้งค่าเหตุการณ์การซื้อ

ก่อนเริ่มต้น

ตรวจสอบว่าคุณได้เพิ่มแท็ก Google ลงในเว็บไซต์และเข้าถึง Analytics และซอร์สโค้ดของเว็บไซต์ได้

คำแนะนำ

  • เปิดใช้โหมดแก้ไขข้อบกพร่องเพื่อให้คุณเห็นเหตุการณ์แบบเรียลไทม์และแก้ปัญหา ได้
  • โปรดตรวจสอบขีดจํากัดของมิติข้อมูลและเมตริกที่กําหนดเองเมื่อส่งพารามิเตอร์ที่กําหนดเองพร้อมกับเหตุการณ์อีคอมเมิร์ซ
  • ตั้งค่า currency เมื่อส่งข้อมูล value (รายได้) เพื่อให้แน่ใจว่าระบบจะคํานวณเมตริกรายได้อย่างถูกต้อง
  • ตั้งค่าพารามิเตอร์อีคอมเมิร์ซแต่ละรายการที่คุณมีข้อมูล ไม่ว่าพารามิเตอร์จะเป็นแบบไม่บังคับหรือไม่ก็ตาม
  • ใช้เว็บไซต์อีคอมเมิร์ซตัวอย่างเพื่อดูตัวอย่างวิธีติดแท็ก เว็บไซต์
  • โปรดทําตามรูปแบบในเอกสารนี้เพื่อให้ข้อมูลแสดงในรายงานอย่างถูกต้อง หากต้องการตั้งค่าอาร์เรย์สินค้าภายนอกอาร์เรย์อีคอมเมิร์ซ ให้ตั้งค่าพารามิเตอร์ currency ที่ระดับเหตุการณ์เมื่อส่งข้อมูล value (รายได้)

การใช้งาน

การใช้การติดตั้งใช้งานอีคอมเมิร์ซโดยปกติจะวัดการกระทำต่อไปนี้

หัวใจสำคัญของการกระทำเหล่านี้คือผลิตภัณฑ์และบริการที่คุณขาย คุณสามารถ แสดงผลิตภัณฑ์และบริการเป็นอาร์เรย์ของสินค้าที่เพิ่มลงใน เหตุการณ์อีคอมเมิร์ซได้ คุณใส่พารามิเตอร์ที่กําหนดเองได้สูงสุด 27 รายการในอาร์เรย์สินค้า นอกเหนือจากพารามิเตอร์ที่กําหนดไว้

ตัวอย่างต่อไปนี้แสดงวิธีสร้างคอลเล็กชันของ items ที่มีการอ้างอิงตลอดทั้งคู่มือนี้ อาร์เรย์ items มีองค์ประกอบได้สูงสุด 200 รายการ

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: 10.01,
      quantity: 3
    },
    {
      item_id: "SKU_12346",
      item_name: "Google Grey Women's Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 3.33,
      index: 1,
      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: "gray",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 21.01,
      quantity: 2
    }
]

เลือกสินค้าจากรายการ

เมื่อผู้ใช้เห็นรายการผลการค้นหา ให้ส่งview_item_listเหตุการณ์ รวมถึงitemsพารามิเตอร์อาร์เรย์ที่มีรายการที่แสดง ดูรายละเอียด เกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิง เหตุการณ์

gtag("event", "view_item_list", {
  item_list_id: "related_products",
  item_list_name: "Related products",
  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: 10.01,
      quantity: 3
    }
  ]
});

เมื่อผู้ใช้เลือกสินค้าจากรายการ ให้ส่งเหตุการณ์ select_item พร้อมกับ สินค้าที่เลือกในพารามิเตอร์อาร์เรย์ items ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "select_item", {
  item_list_id: "related_products",
  item_list_name: "Related products",
  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: 10.01,
      quantity: 3
    }
  ]
});

ดูรายละเอียดสินค้า

หากต้องการวัดจำนวนครั้งที่มีการดูรายละเอียดสินค้า ให้ส่งview_itemเหตุการณ์ ทุกครั้งที่ผู้ใช้ดูหน้าจอรายละเอียดสินค้า ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "view_item", {
  currency: "USD",
  value: 30.03,
  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: 10.01,
      quantity: 3
    }
  ]
});

เพิ่มหรือนำสินค้าออกจากรถเข็นช็อปปิ้ง

วัดการเพิ่มสินค้าลงในรถเข็นช็อปปิ้งโดยส่งadd_to_cartเหตุการณ์ พร้อมสินค้าที่เกี่ยวข้องในitemsอาร์เรย์ ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "add_to_cart", {
  currency: "USD",
  value: 30.03,
  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: 10.01,
      quantity: 3
    }
  ]
});

นอกจากนี้ คุณยังวัดได้เมื่อมีการเพิ่มสินค้าลงในรายการที่อยากได้โดยการส่งเหตุการณ์ add_to_wishlist พร้อมสินค้าที่เกี่ยวข้องในอาร์เรย์ items ดูรายละเอียด เกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิง เหตุการณ์

gtag("event", "add_to_wishlist", {
  currency: "USD",
  value: 30.03,
  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: 10.01,
      quantity: 3
    }
  ],
});

เมื่อผู้ใช้ดูรถเข็นในภายหลัง ให้ส่งเหตุการณ์ view_cart พร้อมกับสินค้าทั้งหมด ในรถเข็น ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "view_cart", {
  currency: "USD",
  value: 30.03,
  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: 10.01,
      quantity: 3
    }
  ]
});

หากต้องการวัดเมื่อผู้ใช้นำสินค้าออกจากรถเข็น ให้ส่งremove_from_cart เหตุการณ์ ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "remove_from_cart", {
  currency: "USD",
  value: 30.03,
  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: 10.01,
      quantity: 3
    }
  ]
});

เริ่มกระบวนการชำระเงิน

วัดขั้นตอนแรกในกระบวนการชำระเงินโดยส่งbegin_checkoutเหตุการณ์ ที่มีสินค้าอย่างน้อย 1 รายการซึ่งกำหนดด้วยช่องที่เกี่ยวข้อง นอกจากนี้ คุณยังเพิ่มคูปองในขั้นตอนนี้ให้กับทั้งคำสั่งซื้อได้โดยเพิ่มคูปองลงในเหตุการณ์ หรือใช้กับสินค้าหนึ่งๆ ได้โดยเพิ่มคูปองลงในองค์ประกอบที่เฉพาะเจาะจงในอาร์เรย์ items ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "begin_checkout", {
  currency: "USD",
  value: 30.03,
  coupon: "SUMMER_FUN",
  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: 10.01,
      quantity: 3
    }
  ]
});

เมื่อผู้ใช้ไปยังขั้นตอนถัดไปในกระบวนการชำระเงินและเพิ่มข้อมูลการจัดส่ง ให้ส่งเหตุการณ์ add_shipping_info ใช้พารามิเตอร์ shipping_tier เพื่อระบุตัวเลือกการนำส่งของผู้ใช้ เช่น "ทางบก" "ทางอากาศ" หรือ "วันถัดไป" ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "add_shipping_info", {
  currency: "USD",
  value: 30.03,
  coupon: "SUMMER_FUN",
  shipping_tier: "Ground",
  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: 10.01,
      quantity: 3
    }
  ]
});

ส่งเหตุการณ์ add_payment_info เมื่อผู้ใช้ส่งข้อมูลการชำระเงิน หากมี ให้ใส่ payment_type กับเหตุการณ์นี้สำหรับวิธีการชำระเงินที่เลือก ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "add_payment_info", {
  currency: "USD",
  value: 30.03,
  coupon: "SUMMER_FUN",
  payment_type: "Credit Card",
  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: 10.01,
      quantity: 3
    }
  ]
});

ทำการซื้อหรือคืนเงิน

วัดการซื้อโดยส่งเหตุการณ์ purchase พร้อมสินค้าอย่างน้อย 1 รายการที่กําหนด ด้วยช่องที่เกี่ยวข้อง ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "purchase", {
    transaction_id: "T_12345",
    // Sum of (price * quantity) for all items.
    value: 72.05,
    tax: 3.60,
    shipping: 5.99,
    currency: "USD",
    coupon: "SUMMER_SALE",
    customer_type: "new",
    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: 10.01,
      quantity: 3
    },
    {
      item_id: "SKU_12346",
      item_name: "Google Grey Women's Tee",
      affiliation: "Google Merchandise Store",
      coupon: "SUMMER_FUN",
      discount: 3.33,
      index: 1,
      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: "gray",
      location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
      price: 21.01,
      promotion_id: "P_12345",
      promotion_name: "Summer Sale",
      quantity: 2
    }]
});

วัดการคืนเงินโดยส่งเหตุการณ์ refund พร้อมระบุ transaction_id ที่เกี่ยวข้อง และกำหนดรายการอย่างน้อย 1 รายการด้วย item_id และ quantity เราขอแนะนําให้คุณรวมข้อมูลสินค้าไว้ในrefundเหตุการณ์เพื่อดูเมตริกการคืนเงินระดับสินค้าใน Analytics

ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "refund", {
  currency: "USD",
  transaction_id: "T_12345", // Transaction ID. Required for purchases and refunds.
  value: 30.03,
  coupon: "SUMMER_FUN",
  shipping: 3.33,
  tax: 1.11,
  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: 10.01,
      quantity: 3
    }
  ]
});

ใช้โปรโมชัน

อีคอมเมิร์ซรองรับการวัดการแสดงผลและการคลิกของโปรโมชันภายใน เช่น แบนเนอร์ที่แสดงเพื่อโปรโมตการลดราคา

โดยปกติแล้ว ระบบจะวัดการแสดงผลโปรโมชันด้วยการดูหน้าจอเริ่มต้นโดย การส่งเหตุการณ์ view_promotion พร้อมพารามิเตอร์ items เพื่อระบุ สินค้าที่ได้รับการโปรโมต ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "view_promotion", {
  creative_name: "Summer Banner",
  creative_slot: "featured_app_1",
  promotion_id: "P_12345",
  promotion_name: "Summer Sale",
  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: 10.01,
      quantity: 3
    }
  ]
});

หากต้องการระบุว่าผู้ใช้คลิกโปรโมชัน ให้ส่งเหตุการณ์ select_promotion พร้อมกับ รายการนั้นเป็นพารามิเตอร์รายการ ดูรายละเอียดเกี่ยวกับพารามิเตอร์ที่จะส่งได้ที่ข้อมูลอ้างอิงเหตุการณ์

gtag("event", "select_promotion", {
  creative_name: "Summer Banner",
  creative_slot: "featured_app_1",
  promotion_id: "P_12345",
  promotion_name: "Summer Sale",
  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: 10.01,
      quantity: 3
    }
  ],
});