การติดตามอีคอมเมิร์ซที่เพิ่มประสิทธิภาพ - iOS SDK

เอกสารนี้แสดงภาพรวมของวิธีวัดการกระทำและการแสดงผลที่เกี่ยวข้องกับอีคอมเมิร์ซในแอปด้วย Google Analytics SDK สำหรับ iOS v3

ภาพรวม

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

การใช้งาน

ก่อนที่จะใช้งานการติดตามอีคอมเมิร์ซที่เพิ่มประสิทธิภาพในแอป คุณต้องเพิ่ม ไลบรารีอีคอมเมิร์ซที่เพิ่มประสิทธิภาพลงในแอป

หลังจากกําหนดค่าแอปพลิเคชันเพื่อใช้อีคอมเมิร์ซที่เพิ่มประสิทธิภาพแล้ว คุณจะทําสิ่งต่อไปนี้ได้

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

การใช้อีคอมเมิร์ซที่เพิ่มประสิทธิภาพโดยทั่วไปจะวัดการแสดงผลของผลิตภัณฑ์และการดำเนินการต่อไปนี้

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

การวัดการแสดงผล

หากต้องการวัดการแสดงผลผลิตภัณฑ์ ให้ตั้งค่าผลิตภัณฑ์และการแสดงผล แล้วส่งไปพร้อมกับ Hit ดังนี้

id tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setId:@"P12345"];
[product setName:@"Android Warhol T-Shirt"];
[product setCategory:@"Apparel/T-Shirts"];
[product setBrand:@"Google"];
[product setVariant:@"Black"];
[product setCustomDimension:1 value:@"Member"];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];

// Sets the product impression for the next available slot, starting with 1.
[builder addProductImpression:product
               impressionList:@"Search Results"
             impressionSource:@"From Search"];
[tracker set:kGAIScreenName value:@"My Impression Screen"];
[tracker send:[builder build]];

ผลิตภัณฑ์ต้องมีค่าชื่อหรือรหัส ค่าอื่นๆ ทั้งหมดเป็นตัวเลือก และไม่จำเป็นต้องตั้งค่า

การวัดการกระทำ

ระบบวัดการกระทำโดยการตั้งค่ามูลค่าผลิตภัณฑ์ จากนั้นตั้งค่าการกระทำของผลิตภัณฑ์เพื่อระบุการดำเนินการที่กำลังทำ

ตัวอย่างเช่น โค้ดต่อไปนี้จะวัดการเลือกผลิตภัณฑ์ที่แสดงในรายการผลการค้นหา

id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setId:@"P12345"];
[product setName:@"Android Warhol T-Shirt"];
[product setCategory:@"Apparel/T-Shirts"];
[product setBrand:@"Google"];
[product setVariant:@"Black"];
[product setCustomDimension:1 value:@"Member"];

GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
[action setAction:kGAIPAClick];
[action setProductActionList:@"Search Results"];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];
[builder setProductAction:action];

// Sets the product for the next available slot, starting with 1
[builder addProduct:product];
[tracker set:kGAIScreenName value:@"My Impression Screen"];
[tracker send:[builder build]];

ผลิตภัณฑ์ต้องมีค่าชื่อหรือรหัส ค่าอื่นๆ ทั้งหมดเป็นตัวเลือก และไม่จำเป็นต้องตั้งค่า

การรวมการแสดงผลและการกระทำ

ในกรณีที่คุณมีทั้งการแสดงผลผลิตภัณฑ์และการดำเนินการ คุณจะรวมและวัดผลได้ใน Hit เดียว

ตัวอย่างด้านล่างแสดงวิธีวัดมุมมองรายละเอียดผลิตภัณฑ์ด้วยส่วนผลิตภัณฑ์ที่เกี่ยวข้อง

// The product from the related products section.
id tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setId:@"P12346"];
[product setName:@"Android Warhol T-Shirt"];
[product setCategory:@"Apparel/T-Shirts"];
[product setBrand:@"Google"];
[product setVariant:@"White"];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];

// Sets the product impression for the next available slot, starting with 1.
[builder addProductImpression:product
               impressionList:@"Related Products"
             impressionSource:@"From Related"];

// The product being viewed.
product = [[GAIEcommerceProduct alloc] init];
[product setId:@"P12345"];
[product setName:@"Android Warhol T-Shirt"];
[product setCategory:@"Apparel/T-Shirts"];
[product setBrand:@"Google"];
[product setVariant:@"Black"];

GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
[action setAction:kGAIPADetail];
[builder setProductAction:action];
// Sets the product for the next available slot, starting with 1.
[builder addProduct:product];
[tracker set:kGAIScreenName value:@"Related Products Screen"];
[tracker send:[builder build]];

การวัดธุรกรรม

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

id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setId:@"P12345"];
[product setName:@"Android Warhol T-Shirt"];
[product setCategory:@"Apparel/T-Shirts"];
[product setBrand:@"Google"];
[product setVariant:@"Black"];
[product setPrice:@29.20];
[product setCouponCode:@"APPARELSALE"];
[product setQuantity:@1];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"Ecommerce"
                                                                       action:@"Purchase"
                                                                        label:nil
                                                                        value:nil];
GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
[action setAction:kGAIPAPurchase];
[action setTransactionId:@"T12345"];
[action setAffiliation:@"Google Store - Online"];
[action setRevenue:@37.39];
[action setTax:@2.85];
[action setShipping:@5.34];
[action setCouponCode:@"SUMMER2013"];
[builder setProductAction:action];

// Sets the product for the next available slot, starting with 1
[builder addProduct:product];
[tracker send:[builder build]];

การระบุสกุลเงิน

โดยค่าเริ่มต้น คุณสามารถกำหนดค่าสกุลเงินทั่วไปที่ใช้ทั่วโลกสำหรับธุรกรรมและรายการทั้งหมดได้ผ่านอินเทอร์เฟซเว็บการจัดการของ Google Analytics

ต้องระบุสกุลเงินท้องถิ่นในมาตรฐาน ISO 4217 อ่านเอกสารข้อมูลอ้างอิงรหัสสกุลเงินเพื่อดูรายการสกุลเงิน Conversion ทั้งหมดที่รองรับ

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

id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTracker"];
[tracker set:kGAIScreenName value:@"transaction"];
[tracker set:kGAICurrencyCode value:@"EUR"]; // Set tracker currency to Euros.
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView];
[tracker send:[builder build]];

การวัดการคืนเงิน

หากต้องการคืนเงินสำหรับทั้งธุรกรรม ให้ตั้งค่าการดำเนินการของผลิตภัณฑ์เพื่อระบุรหัสธุรกรรมและประเภทการดำเนินการคืนเงิน ดังนี้

// Refund an entire transaction.
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"Ecommerce"
                                                                       action:@"Refund"
                                                                        label:nil
                                                                        value:nil];
GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
[action setAction:kGAIPARefund];
[action setTransactionId:@"T12345"];
[builder setProductAction:action];
[tracker send:[builder build]];

หากไม่พบธุรกรรมที่ตรงกัน ระบบจะไม่ดำเนินการคืนเงิน

หากต้องการวัดการคืนเงินบางส่วน ให้ตั้งค่าการดำเนินการของผลิตภัณฑ์เพื่อระบุรหัสธุรกรรม รหัสผลิตภัณฑ์ และจำนวนผลิตภัณฑ์ที่จะคืนเงิน

// Refund a single product.
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"Ecommerce"
                                                                       action:@"Refund"
                                                                        label:nil
                                                                        value:nil];
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setId:@"P12345"]; // Product ID is required for partial refund.
[product setQuantity:@1]; // Quanity is required for partial refund.
[builder addProduct:product];

GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
[action setAction:kGAIPARefund];
[action setTransactionId:@"T12345"]; // Transaction ID is required for partial refund.
[builder setProductAction:action];
[tracker send:[builder build]];

การใช้เหตุการณ์ที่ไม่มีการโต้ตอบเพื่อการคืนเงิน

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

// Refund an entire transaction.
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"Ecommerce"
                                                                       action:@"Refund"
                                                                        label:nil
                                                                        value:nil];

[builder set:@"1" forKey:kGAINonInteraction];

GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
[action setAction:kGAIPARefund];
[action setTransactionId:@"T12345"];

[builder setProductAction:action];
[tracker send:[builder build]];

การวัดกระบวนการชำระเงิน

วิธีวัดแต่ละขั้นตอนในกระบวนการชำระเงิน

  1. เพิ่มโค้ดติดตามเพื่อวัดแต่ละขั้นตอนของกระบวนการชำระเงิน
  2. เพิ่มโค้ดติดตามเพื่อวัดตัวเลือกขั้นตอนการชำระเงิน (หากมี)
  3. (ไม่บังคับ) ตั้งชื่อขั้นตอนที่ใช้งานง่ายสำหรับรายงาน Funnel การชําระเงินโดยการกําหนดค่าการตั้งค่าอีคอมเมิร์ซในส่วนผู้ดูแลระบบของอินเทอร์เฟซเว็บ

1. การวัดขั้นตอนการเช็คเอาต์

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

Step ช่อง

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

Option ช่อง

หากคุณมีข้อมูลเพิ่มเติมเกี่ยวกับขั้นตอนการเช็คเอาต์ที่ระบุในขณะที่มีการวัดขั้นตอน คุณจะตั้งค่าช่องตัวเลือกการชําระเงินให้มีการดําเนินการชําระเงินเพื่อบันทึกข้อมูลนี้ได้ ตัวอย่างเช่น ประเภทการชำระเงินเริ่มต้นสำหรับผู้ใช้ (เช่น "Visa")

การวัดขั้นตอนการเช็คเอาต์

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

ตัวอย่างต่อไปนี้แสดงวิธีวัดขั้นตอนแรกของกระบวนการชําระเงินโดยใช้ผลิตภัณฑ์รายการเดียว และข้อมูลเพิ่มเติมเกี่ยวกับประเภทการชําระเงิน

id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init];
[product setId:@"P12345"];
[product setName:@"Android Warhol T-Shirt"];
[product setCategory:@"Apparel/T-Shirts"];
[product setBrand:@"Google"];
[product setVariant:@"Black"];
[product setPrice:@29.20];
[product setCouponCode:@"APPARELSALE"];
[product setQuantity:@1];

GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"Ecommerce"
                                                                       action:@"Checkout"
                                                                        label:nil
                                                                        value:nil];

// Add the step number and additional info about the checkout to the action.
GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
[action setAction:kGAIPACheckout];
[action setCheckoutStep:@1];
[action setCheckoutOption:@"Visa"];

[builder addProduct:product];
[builder setProductAction:action];
[tracker send:[builder build]];

2. การวัดตัวเลือกขั้นตอนการชำระเงิน

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

หากต้องการวัดตัวเลือกขั้นตอนการชำระเงิน ให้ตั้งค่าการดำเนินการของผลิตภัณฑ์เพื่อระบุตัวเลือกขั้นตอนการชำระเงินและระบุหมายเลขขั้นตอนและคำอธิบายตัวเลือก

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

// (On "Next" button click.)
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"Ecommerce"
                                                                       action:@"CheckoutOption"
                                                                        label:nil
                                                                        value:nil];

GAIEcommerceProductAction *action = [[GAIEcommerceProductAction alloc] init];
[action setAction:kGAIPACheckoutOption];
[action setCheckoutStep:@1];
[action setCheckoutOption:@"Fedex"];

[builder setProductAction:action];
[tracker send:[builder build]];
// Advance to next page.

3. การกำหนดค่า Funnel การชำระเงิน

คุณสามารถกำหนดชื่อที่สื่อความหมายซึ่งจะใช้ในรายงานแต่ละขั้นตอนในกระบวนการชำระเงินได้ หากต้องการกำหนดค่าชื่อเหล่านี้ ให้ไปที่ส่วนผู้ดูแลระบบของอินเทอร์เฟซเว็บ Google Analytics เลือกข้อมูลพร็อพเพอร์ตี้ (โปรไฟล์) และคลิกการตั้งค่าอีคอมเมิร์ซ ทำตามวิธีการตั้งค่าอีคอมเมิร์ซเพื่อติดป้ายกำกับขั้นตอนการเช็คเอาต์แต่ละขั้นที่คุณต้องการติดตาม

การตั้งค่าอีคอมเมิร์ซในส่วนผู้ดูแลระบบของอินเทอร์เฟซเว็บ Google Analytics เปิดใช้อีคอมเมิร์ซและเพิ่มป้ายกำกับขั้นตอนในกระบวนการชำระเงินแล้ว 4 รายการ ได้แก่ 1. ตรวจสอบรถเข็น, 2. รวบรวมข้อมูลการชำระเงิน, 3. ยืนยันรายละเอียดการซื้อ 4. ใบเสร็จ
ภาพที่ 1: การตั้งค่าอีคอมเมิร์ซ - กระบวนการชำระเงิน

การวัดโปรโมชันภายใน

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

การแสดงผลของโปรโมชัน

โดยทั่วไป การแสดงผลของโปรโมชันภายในจะวัดด้วยการดูหน้าจอครั้งแรกหรือเหตุการณ์โดยการกำหนดมูลค่าโปรโมชัน เช่น

id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIEcommercePromotion *promotion = [[GAIEcommercePromotion alloc] init];
[promotion setId:@"PROMO_1234"];
[promotion setName:@"Summer Sale"];
[promotion setCreative:@"summer_banner2"];
[promotion setPosition:@"banner_slot1"];

GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"Ecommerce"
                                                                       action:@"Promotion"
                                                                        label:nil
                                                                        value:nil];

[builder addPromotion:promotion];
[tracker send:[builder build]];

จำนวนการคลิกโปรโมชัน

วัดการคลิกโปรโมชันภายในได้โดยใช้มูลค่าโปรโมชัน แล้วกำหนดมูลค่าการดำเนินการของผลิตภัณฑ์เพื่อระบุการคลิกโปรโมชัน เช่น

id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:@"MyTrackingId"];
GAIEcommercePromotion *promotion = [[GAIEcommercePromotion alloc] init];
[promotion setId:@"PROMO_1234"];
[promotion setName:@"Summer Sale"];
[promotion setCreative:@"summer_banner2"];
[promotion setPosition:@"banner_slot1"];

GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"Internal Promotions"
                                                                       action:@"click"
                                                                        label:@"Summer Sale"
                                                                        value:nil];

[builder set:kGAIPromotionClick forKey:kGAIPromotionAction];
[builder addPromotion:promotion];
[tracker send:[builder build]];