เอกสารนี้มีไว้สำหรับนักพัฒนาซอฟต์แวร์บนอุปกรณ์เคลื่อนที่ และอธิบายวิธีใช้ Google Analytics เพื่อวัดการโต้ตอบของผู้ใช้และตอบคำถามเกี่ยวกับการใช้แอป
เกริ่นนำ
Google Analytics สำหรับแอปบนอุปกรณ์เคลื่อนที่มีแพลตฟอร์มสำหรับวัดการโต้ตอบของผู้ใช้ ซึ่งช่วยให้คุณเข้าใจและเพิ่มประสิทธิภาพการมีส่วนร่วมของผู้ใช้กับแอปได้ดีขึ้น
การใช้งานเริ่มต้นของ Google Analytics จะให้ข้อมูลต่อไปนี้เกี่ยวกับแอปของคุณโดยอัตโนมัติ
- จำนวนผู้ใช้และเซสชัน
- ระยะเวลาเซสชัน
- ระบบปฏิบัติการ
- รุ่นอุปกรณ์
- ภูมิศาสตร์
คู่มือนี้จะอธิบายวิธีใช้งานฟีเจอร์เพิ่มเติมของ Google Analytics เพื่อให้เข้าใจผู้ใช้และพฤติกรรมผู้ใช้มากขึ้น
ก่อนเริ่มต้น
ก่อนที่จะอ่านคู่มือนี้ เราขอแนะนำให้คุณอ่านแหล่งข้อมูลด้านล่างเพื่อเรียนรู้วิธีตั้งค่า Google Analytics สำหรับแอปบนอุปกรณ์เคลื่อนที่
- ติดตั้ง SDK สำหรับแพลตฟอร์มที่คุณกำหนดเป้าหมาย ดังนี้
- แนวทางปฏิบัติแนะนำสำหรับการตั้งค่า Analytics สำหรับแอปบนอุปกรณ์เคลื่อนที่
ภาพรวม
จับมังกร
คู่มือนี้ใช้แอปตัวอย่างเพื่อแนะนำคุณตลอดขั้นตอนการใช้งานฟีเจอร์เพิ่มเติมของ Google Analytics แอปดังกล่าวมีชื่อว่า Dragon Catcher และมีลักษณะของเกมเพลย์ดังต่อไปนี้
- ระดับที่ประกอบด้วยผู้เล่น มังกร พื้นที่ที่มีรั้วล้อมรอบ บ่อน้ำ และต้นไม้
- วัตถุประสงค์ของผู้เล่นคือการจับมังกรโดยย้ายมังกรไปไว้ในพื้นที่ล้อมรั้ว
- ผู้เล่นสามารถเข้าชมพื้นที่ต่างๆ ของด่านและวัตถุต่างๆ เช่น บ่อน้ำหรือต้นไม้วิเศษได้
- ผู้เล่นจะเลื่อนสู่ระดับถัดไปได้เมื่อจับมังกรได้ครบทั้งหมดแล้ว
- ผู้เล่นเริ่มเกมในระดับแรกซึ่งเรียกว่า Barren Fields
เมื่อใช้ Google Analytics คำถามบางข้อเกี่ยวกับพฤติกรรมผู้ใช้ที่ตอบได้เกี่ยวกับตัวจับมังกรมีดังนี้
- ผู้ใช้ของฉันดำเนินการอะไรบ้าง (กิจกรรม)
- ผู้ใช้ใช้จ่ายในแอปของฉันมากน้อยแค่ไหน (อีคอมเมิร์ซ)
- ผู้ใช้บรรลุวัตถุประสงค์ของแอปหรือไม่ (เป้าหมาย)
- ผู้ใช้ที่มีลักษณะเฉพาะหนึ่งๆ มีพฤติกรรมอย่างไร (มิติข้อมูล/เมตริกที่กำหนดเอง)
- ผู้ใช้ใช้เวลานานเท่าใดในการทำงานให้เสร็จสิ้น (การกำหนดเวลาที่กำหนดเอง)
ส่วนที่เหลือของเอกสารนี้จะแสดงให้เห็นว่าคุณจะตอบคำถามเหล่านี้ได้อย่างไรโดยการนำฟีเจอร์ของ Google Analytics มาใช้กับเกมจับมังกร
ผู้ใช้ของฉันดำเนินการอะไรบ้าง (กิจกรรม)
หากมีการกระทำสำคัญที่ต้องการติดตามภายในแอป ก็สามารถใช้เหตุการณ์เพื่ออธิบายการกระทำนี้ใน Google Analytics เหตุการณ์ประกอบด้วยพารามิเตอร์ 4 รายการ ได้แก่ category
, action
, label
และ value
สำหรับรายละเอียดเกี่ยวกับวิธีการทำงานของเหตุการณ์ใน Google Analytics โปรดดูโครงสร้างของการติดตามเหตุการณ์
เช่น ใน Dragon Catcher ผู้ใช้กำลังช่วยมังกรหรือเข้าชมพื้นที่หนึ่งๆ ในเลเวลเป็นการกระทำสำคัญที่เราต้องการวัดโดยใช้เหตุการณ์ ข้อมูลโค้ดด้านล่างแสดงวิธีวัดผลใน Google Analytics
Android SDK v4
// To determine how many dragons are being rescued, send an event when the // player rescues a dragon. tracker.send(new HitBuilders.EventBuilder() .setCategory("Barren Fields") .setAction("Rescue") .setLabel("Dragon") .setValue(1) .build()); // To determine if players are visiting the magic tree, send an event when the // player is in the vicinity of the magic tree. tracker.send(new HitBuilders.EventBuilder() .setCategory("Barren Fields") .setAction("Visited") .setLabel("Magic Tree") .setValue(1) .build()); // To determine if players are visiting the well, send an event when the player // is in the vicinity of the well. tracker.send(new HitBuilders.EventBuilder() .setCategory("Barren Fields") .setAction("Visited") .setLabel("Well") .setValue(1) .build());
SDK สำหรับ iOS v3
// To determine how many dragons are being rescued, send an event when the // player rescues a dragon. [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Barren Fields" action:@"Rescue" label:@"Dragon" value:@1] build]]; // To determine if players are visiting the magic tree, send an event when the // player is in the vicinity of the magic tree. [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Barren Fields" action:@"Visited" label:@"Magic Tree" value:@1] build]]; // To determine if players are visiting the well, send an event when the player // is in the vicinity of the well. [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Barren Fields" action:@"Visited" label:@"Well" value:@1] build]];
ปลั๊กอิน GA สำหรับ Unity v3
// To determine how many dragons are being rescued, send an event when the // player rescues a dragon. googleAnalytics.LogEvent("Barren Fields", "Rescue", "Dragon", 1); // To determine if players are visiting the magic tree, send an event when the // player is in the vicinity of the magic tree. googleAnalytics.LogEvent("Barren Fields", "Visited", "Magic Tree", 1); // To determine if players are visiting the well, send an event when the player // is in the vicinity of the well. googleAnalytics.LogEvent("Barren Fields", "Visited", "Well", 1);
การวัด "รางวัลพิเศษ" ของผู้เล่น
คุณสามารถวัด "รางวัลพิเศษ" ของผู้เล่นได้โดยใช้เหตุการณ์ใน Google Analytics ตัวอย่างเช่น หากต้องการวัดรางวัลพิเศษในการช่วยมังกร 5 ตัว ระบบจะบันทึกจำนวนมังกรที่ผู้เล่นช่วยได้ จากนั้นเมื่อผู้เล่นถึงเกณฑ์แล้ว ระบบจะส่งเหตุการณ์ไปยัง Google Analytics ดังนี้
Android SDK v4
if (numDragonsRescued > 5) { if (!user.hasAchievement(RESCUED_ACHIEVEMENT) { tracker.send(new HitBuilders.EventBuilder() .setCategory("Achievement") .setAction("Unlocked") .setLabel("5 Dragons Rescued") .setValue(1) .build()); } else { tracker.send(new HitBuilders.EventBuilder() .setCategory("Achievement") .setAction("Earned") .setLabel("5 Dragons Rescued") .setValue(1) .build()); } }
SDK สำหรับ iOS v3
if (numDragonsRescued > 5) { if (![user hasAchievement:RESCUED_ACHIEVEMENT]) { [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Achievement" action:@"Unlocked" label:@"5 Dragons Rescued" value:@1] build]]; } else { [tracker send:[[GAIDictionaryBuilder createEventWithCategory:@"Achievement" action:@"Earned" label:@"5 Dragons Rescued" value:@1] build]]; } }
ปลั๊กอิน GA สำหรับ Unity v3
if (numDragonsRescued > 5) { if (!user.HasAchievement(RESCUED_ACHIEVEMENT) { googleAnalytics.LogEvent("Achievement", "Unlocked", "5 Dragons Rescued", 1); } else { googleAnalytics.LogEvent("Achievement", "Earned", "5 Dragons Rescued", 1); } }
คู่มือนักพัฒนาซอฟต์แวร์สำหรับกิจกรรม
- การติดตามผลของกิจกรรม - Android SDK
- การติดตามเหตุการณ์ - iOS SDK
- เหตุการณ์ - ปลั๊กอิน GA สำหรับ Unity
การรายงานเหตุการณ์
ข้อมูลกิจกรรมมีให้บริการในประเทศต่อไปนี้
- อินเทอร์เฟซเว็บในส่วนพฤติกรรม >> เหตุการณ์ >> เหตุการณ์ยอดนิยม
- รายงานที่กำหนดเอง
- API การรายงานหลัก
ผู้ใช้ใช้จ่ายในแอปของฉันมากน้อยแค่ไหน (อีคอมเมิร์ซที่เพิ่มประสิทธิภาพ)
หากต้องการวัดการซื้อในแอปของผู้ใช้ คุณสามารถใช้การติดตามอีคอมเมิร์ซเพื่อติดตามการซื้อและทำความเข้าใจประสิทธิภาพของผลิตภัณฑ์ที่เกี่ยวข้องและพฤติกรรมของผู้ใช้ การติดตามอีคอมเมิร์ซใช้วัดการซื้อสินค้าที่เจาะจงหรือสกุลเงินเสมือนได้
ตัวอย่างเช่น ใน Dragon Catcher หากต้องการวัดการซื้อบางรายการ ระบบจะส่งข้อมูลธุรกรรมไปยัง Google Analytics พร้อมกับเหตุการณ์ต่อไปนี้
Android SDK v4
Product product = new Product() .setName("Dragon Food") .setPrice(40.00); ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE) .setTransactionId("T12345"); // Add the transaction data to the event. HitBuilders.EventBuilder builder = new HitBuilders.EventBuilder() .setCategory("In-Game Store") .setAction("Purchase") .addProduct(product) .setProductAction(productAction); // Send the transaction data with the event. tracker.send(builder.build());
SDK สำหรับ iOS v3
GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; [product setName:@"Dragon Food"]; [product setPrice:@40.00]; GAIEcommerceProductAction *productAction = [[GAIEcommerceProductAction alloc] init]; [productAction setAction:kGAIPAPurchase]; [productAction setTransactionId:@"T12345"]; GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"In-Game Store" action:@"Purchase" label:nil value:nil]; // Add the transaction data to the event. [builder setProductAction:productAction]; [builder addProduct:product]; // Send the transaction data with the event. [tracker send:[builder build]];
ปลั๊กอิน GA สำหรับ Unity v3
// Note: Using Android SDK v3 and standard Ecommerce tracking. googleAnalytics.LogItem("T12345", "Dragon Food", "Food_SKU", "Items", 40.00, 1); googleAnalytics.LogTransaction("T12345", "In-Game Store", 40.00, 0.00, 0.00);
หากผู้ใช้ซื้อสกุลเงินเสมือน เราขอแนะนำให้คุณวัดการแลกเปลี่ยนเงินจริงเมื่อส่งข้อมูลธุรกรรมไปยัง Google Analytics เมื่อผู้ใช้ใช้จ่ายสกุลเงินเสมือนเพื่อซื้อสินค้า ให้วัดผลโดยใช้เหตุการณ์ เช่น
Android SDK v4
/** * When the user purchases the virtual currency (Gems) measure the transaction * using enhanced ecommerce. */ Product product = new Product() .setName("2500 Gems") .setPrice(5.99); ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE) .setTransactionId("T67890"); // Add the transaction to the screenview. HitBuilders.ScreenViewBuilder builder = new HitBuilders.ScreenViewBuilder() .addProduct(product) .setProductAction(productAction); // Send the transaction with the screenview. tracker.setScreenName("In-Game Store"); tracker.send(builder.build()); /** * When the user purchases an item using the virtual currency (Gems) send an * event to measure this in Google Analytics. */ HitBuilders.EventBuilder builder = new HitBuilders.EventBuilder() .setCategory("In-Game Store") .setAction("Purchase") .setLabel("Sword") .setValue(35); tracker.send(builder.build());
SDK สำหรับ iOS v3
/** * When the user purchases the virtual currency (Gems) measure the transaction * using enhanced ecommerce. */ GAIEcommerceProduct *product = [[GAIEcommerceProduct alloc] init]; [product setName:@"2500 Gems"]; [product setPrice:@5.99]; GAIEcommerceProductAction *productAction = [[GAIEcommerceProductAction alloc] init]; [productAction setAction:kGAIPAPurchase]; [productAction setTransactionId:@"T67890"]; GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createScreenView]; // Add the transaction data to the screenview. [builder setProductAction:productAction]; [builder addProduct:product]; // Send the transaction with the screenview. [tracker set:kGAIScreenName value:@"In-Game Store"] [tracker send:[builder build]]; /** * When the user purchases an item using the virtual currency (Gems) send an * event to measure this in Google Analytics. */ GAIDictionaryBuilder *builder = [GAIDictionaryBuilder createEventWithCategory:@"In-Game Store" action:@"Purchase" label:@"Sword" value:@35]; [tracker send:[builder build]];
ปลั๊กอิน GA สำหรับ Unity v3
// Note: Using Android SDK v3 and standard Ecommerce tracking. /** * When the user purchases the virtual currency (Gems) measure the transaction * using enhanced ecommerce. */ googleAnalytics.LogItem("T12345", "2500 Gems", "GEM2500_SKU", "Items", 5.99, 1); googleAnalytics.LogTransaction("T12345", "In-Game Store", 5.99, 0.00, 0.00); /** * When the user purchases an item using the virtual currency (Gems) send an * event to measure this in Google Analytics. */ googleAnalytics.LogEvent("In-Game Store", "Purchase", "Sword", 35);
คู่มือนักพัฒนาซอฟต์แวร์เกี่ยวกับอีคอมเมิร์ซที่เพิ่มประสิทธิภาพ
- การติดตามอีคอมเมิร์ซที่เพิ่มประสิทธิภาพ - Android SDK
- การติดตามอีคอมเมิร์ซที่เพิ่มประสิทธิภาพ - iOS SDK
- อีคอมเมิร์ซ - ปลั๊กอิน GA สำหรับ Unity
การรายงานสําหรับอีคอมเมิร์ซที่เพิ่มประสิทธิภาพ
ข้อมูลอีคอมเมิร์ซมีให้บริการในประเทศต่อไปนี้
ผู้ใช้บรรลุวัตถุประสงค์ของแอปหรือไม่ (เป้าหมาย)
หากคุณมีวัตถุประสงค์ที่เจาะจงสำหรับแอปที่ต้องการให้ผู้ใช้ทำ คุณก็กำหนดและวัดวัตถุประสงค์เหล่านี้ได้โดยใช้เป้าหมายใน Google Analytics เช่น เป้าหมายอาจเป็นการทำให้ผู้ใช้ไปถึงระดับหนึ่งๆ ของเกมหรือซื้อสินค้า หากต้องการดูข้อมูลเพิ่มเติมเกี่ยวกับวิธีการทำงานของเป้าหมาย ให้ดูที่เกี่ยวกับเป้าหมาย (ศูนย์ช่วยเหลือ)
ในเกม Dragon Catcher คุณสามารถตั้งค่าเป้าหมายเพื่อวัดว่าจะมีการซื้อในแอปเมื่อใด หากมีการส่งเหตุการณ์ไปยัง Google Analytics สำหรับการซื้อแต่ละครั้ง คุณสามารถกำหนดเป้าหมายในผู้ดูแลระบบอินเทอร์เฟซเว็บได้โดยไม่ต้องมีโค้ดเพิ่มเติม โดยใช้พารามิเตอร์ต่อไปนี้
- ประเภทเป้าหมาย (เท่ากับ): เหตุการณ์
- หมวดหมู่ (เท่ากับ): ร้านค้าในเกม
- การดำเนินการ (เท่ากับ): การซื้อ
- ใช้มูลค่าเหตุการณ์เป็นมูลค่าเป้าหมายสำหรับ Conversion: ใช่
การรายงานเป้าหมาย
ข้อมูลเป้าหมายอยู่ใน
- อินเทอร์เฟซเว็บใน Conversion >> เป้าหมาย >> ภาพรวม
- รายงานที่กำหนดเอง
- API การรายงานหลัก
ผู้ใช้ที่มีลักษณะเฉพาะหนึ่งๆ มีพฤติกรรมอย่างไร (มิติข้อมูลและเมตริกที่กำหนดเอง)
หากต้องการติดตามผู้ใช้ด้วยแอตทริบิวต์/ลักษณะ/ข้อมูลเมตาที่เฉพาะเจาะจง คุณสามารถใช้มิติข้อมูลที่กำหนดเองเพื่อส่งข้อมูลประเภทนี้ไปยัง Google Analytics และการวิเคราะห์ได้ ดูข้อมูลอ้างอิงคุณลักษณะมิติข้อมูลและเมตริกที่กำหนดเองเพื่อดูข้อมูลเพิ่มเติมเกี่ยวกับวิธีการทำงานของมิติข้อมูลที่กำหนดเอง
เช่น ในเกมจับมังกร หากต้องการทราบเปอร์เซ็นต์ของผู้ใช้ที่อยู่ในระดับแรก ระดับที่ 2 เป็นต้น คุณสามารถตั้งค่ามิติข้อมูลที่กำหนดเองด้วยระดับปัจจุบันของผู้ใช้และส่งไปยัง Google Analytics ได้ ขั้นตอนมีดังต่อไปนี้
- สร้างมิติข้อมูลที่กําหนดเองที่มีขอบเขต
User
ระบบจะใช้ขอบเขตUser
เนื่องจากค่านี้ควรคงอยู่ในทุกเซสชันของผู้ใช้ ดูตั้งค่าหรือแก้ไขมิติข้อมูลที่กำหนดเอง (ศูนย์ช่วยเหลือ) - อัปเดตค่ามิติข้อมูลที่กำหนดเองเมื่อระดับของผู้ใช้มีการเปลี่ยนแปลง
ตัวอย่างต่อไปนี้แสดงวิธีอัปเดตสถานะของผู้ใช้ใน Google Analytics เมื่อดัชนีมิติข้อมูลที่กําหนดเองระดับผู้ใช้เป็น 1
และระดับของผู้ใช้เปลี่ยนเป็น Barren Fields
Android SDK v4
// Set the user level custom dimension when sending a hit to Google Analytics // such as a screenview or event. tracker.setScreen("BarrenFields"); tracker.send(new HitBuilders.ScreenViewBuilder() .setCustomDimension(1, "Barren Fields") .build() );
SDK สำหรับ iOS v3
// Set the user level custom dimension when sending a hit to Google Analytics // such as a screenview or event. [tracker set:kGAIScreenName value:@"BarrenFields"]; [tracker send:[[[GAIDictionaryBuilder createScreenView] set:@"Barren Fields" forKey:[GAIFields customDimensionForIndex:1]] build]];
ปลั๊กอิน GA สำหรับ Unity v3
// Set the user level custom dimension when sending a hit to Google Analytics // such as a screenview or event. googleAnalytics.LogScreen(new AppViewHitBuilder() .SetScreenName("BarrenFields").SetCustomDimension(1, "Barren Fields"));
คู่มือนักพัฒนาซอฟต์แวร์เกี่ยวกับมิติข้อมูลและเมตริกที่กำหนดเอง
- มิติข้อมูลและเมตริกที่กำหนดเอง - Android SDK
- มิติข้อมูลและเมตริกที่กำหนดเอง - iOS SDK
- มิติข้อมูลและเมตริกที่กำหนดเอง - ปลั๊กอิน GA สำหรับ Unity
การรายงานสำหรับมิติข้อมูลและเมตริกที่กำหนดเอง
คุณสามารถรวมมิติข้อมูลที่กำหนดเองและนำไปใช้เป็นกลุ่มกับสิ่งต่อไปนี้ได้
- รายงานมาตรฐานส่วนใหญ่ในอินเทอร์เฟซเว็บ
- รายงานที่กำหนดเอง
- API การรายงานหลัก
การใช้มิติข้อมูลที่กำหนดเองเป็นกลุ่มจะช่วยให้วิเคราะห์ผู้ใช้ที่กำลังอยู่ในระดับใดระดับหนึ่งภายในเกมได้
ผู้ใช้ใช้เวลานานเท่าใดในการทำงานให้เสร็จสิ้น (การกำหนดเวลาที่กำหนดเอง)
หากต้องการวัดว่าใช้ระยะเวลานานเท่าไรในแอป คุณสามารถใช้ระยะเวลาของผู้ใช้สําหรับการวัดผลที่อิงตามเวลาใน Google Analytics ได้ กรอบเวลาของผู้ใช้คล้ายกับเหตุการณ์ แต่เป็นไปตามช่วงเวลา และอาจรวมถึง category
, value
, name (variable)
และ label
ได้ หากต้องการดูข้อมูลเกี่ยวกับวิธีการทํางานของระยะเวลาของผู้ใช้ โปรดดูเกี่ยวกับความเร็วเว็บไซต์
เช่น ในเกมจับมังกรเพื่อวัดว่าผู้ใช้ใช้เวลานานเท่าใดในการช่วยเหลือมังกรตัวแรก คุณสามารถส่งคำอย่างเช่น
Android SDK v4
// Build and send a timing hit. tracker.send(new HitBuilders.TimingBuilder() .setCategory("Barren Fields") .setValue(45000) // 45 seconds. .setVariable("First Rescue") .setLabel("Dragon") .build());
SDK สำหรับ iOS v3
[tracker send:[[GAIDictionaryBuilder createTimingWithCategory:@"Barren Fields" interval:@45000 // 45 seconds. name:@"First Rescue" label:@"Dragon"] build]];
ปลั๊กอิน GA สำหรับ Unity v3
// Build and send a timing hit. googleAnalytics.LogTiming("Barren Fields",45000,"First Rescue","Dragon");
คู่มือนักพัฒนาซอฟต์แวร์เกี่ยวกับระยะเวลาที่กำหนดเอง
- ระยะเวลาของผู้ใช้ - Android SDK
- ระยะเวลาของผู้ใช้ - iOS SDK
- ระยะเวลาของผู้ใช้ - ปลั๊กอิน GA สำหรับ Unity
การรายงานสำหรับช่วงเวลาที่กำหนดเอง
ข้อมูลเวลาที่กำหนดเองจะใช้ได้ในประเทศต่อไปนี้
- เว็บอินเทอร์เฟซในส่วนพฤติกรรม >> ความเร็วของแอป
- รายงานที่กำหนดเอง
- API การรายงานหลัก
แหล่งข้อมูลที่เกี่ยวข้อง
- Analytics Academy - เพิ่มพูนทักษะในการใช้ Analytics ด้วยหลักสูตรออนไลน์ฟรีที่รวมถึงความรู้พื้นฐานเกี่ยวกับ Analytics สำหรับแอปบนอุปกรณ์เคลื่อนที่
- API และ SDK รวบรวมข้อมูล - เรียนรู้เกี่ยวกับวิธีต่างๆ ที่คุณสามารถส่งข้อมูลไปยัง Google Analytics ได้