A/B Test คืออะไร?
A/B Test คืออะไร?
หัวข้อที่มีชื่อว่า “A/B Test คืออะไร?”A/B test หรือที่เรียกว่า experiment คือวิธีการเปรียบเทียบ variation สองแบบขึ้นไปของประสบการณ์ใช้งานผลิตภัณฑ์อย่างมีการควบคุม เพื่อหาว่าแบบไหนบรรลุผลลัพธ์ที่ต้องการได้ดีกว่ากัน แทนที่จะเดาเอาเอง คุณปล่อยให้พฤติกรรมของผู้ใช้จริงเป็นตัวบอก
ใน GrowthBook ทุก experiment เริ่มต้นด้วย hypothesis: ข้อความที่สามารถพิสูจน์ได้ เช่น “การเปลี่ยนสีปุ่ม call-to-action จากสีเทาเป็นสีเขียวจะเพิ่ม click-through rate” จากนั้นคุณกำหนด variation (ต้นฉบับ control และ treatment อย่างน้อยหนึ่งแบบ) แบ่ง traffic ระหว่างกัน เก็บข้อมูล metric และใช้การวิเคราะห์ทางสถิติเพื่อตัดสินใจอย่างมั่นใจ
Feature-flag experiment กับ Experiments UI
หัวข้อที่มีชื่อว่า “Feature-flag experiment กับ Experiments UI”GrowthBook มีสองแนวทางในการรัน experiment:
Feature-flag experiment เชื่อมต่อ experiment เข้ากับ feature flag โดยตรง โค้ดของคุณเรียก gb.getFeatureValue('experiment-key', 'control') อยู่แล้วเพื่ออ่านฟีเจอร์ GrowthBook จะแอบ assign ผู้ใช้แต่ละคนเข้า variation bucket และบันทึก exposure ไว้ แนวทางนี้แยก experimentation logic ออกจาก UI และเป็นแนวทางที่แนะนำสำหรับทีม product และ engineering
Experiments UI ให้คุณกำหนด experiment โดยไม่ต้องแตะ feature flag เหมาะสำหรับ visual หรือ content experiment ที่บริหารผ่าน interface แบบ no-code ภายใต้นั้นยังคงใช้ engine การ assignment และ metric เดียวกัน
ทั้งสองแนวทางใช้การวิเคราะห์ทางสถิติที่เหมือนกัน หมายความว่าคุณสามารถเปรียบเทียบผลลัพธ์และรวมความรู้ทั่วทั้งโปรแกรมได้
Lifecycle ของ experiment
หัวข้อที่มีชื่อว่า “Lifecycle ของ experiment”ทุก experiment ใน GrowthBook ผ่านห้าขั้นตอน:
- Hypothesis — ระบุอย่างชัดเจนว่าคุณเชื่อว่าจะเกิดอะไรขึ้นและทำไม hypothesis ที่ดีต้องระบุการเปลี่ยนแปลง ทิศทางที่คาดหวัง และ metric ที่จะได้รับผลกระทบ
- Variations — กำหนด control (ประสบการณ์ปัจจุบัน) และ variation treatment อย่างน้อยหนึ่งแบบ ควรเปลี่ยนแปลงให้เฉพาะเจาะจง: การทดสอบหลายอย่างพร้อมกันทำให้ไม่รู้ว่าอะไรเป็นตัวขับเคลื่อนผลลัพธ์
- Assignment — GrowthBook assign ผู้ใช้แต่ละคนเข้า variation เดียวโดยใช้ deterministic hash ของ user identifier ที่เสถียร (เช่น user ID หรือ anonymous device ID) ซึ่งหมายความว่าผู้ใช้จะเห็น variation เดิมทุกครั้งโดยไม่ต้องเก็บข้อมูลฝั่ง server
- Metrics — เชื่อมต่อ data source และกำหนด goal metric (เช่น conversion rate, revenue per user) และ guardrail metric (เช่น page load time) ที่ต้องการตรวจสอบไม่ให้ถดถอย
- Decision — เมื่อถึง statistical significance หรือ sample size ที่วางแผนไว้ GrowthBook จะแสดงผู้ชนะ จากนั้นคุณ ship variation ที่ชนะไปยังผู้ใช้ 100% และ archive experiment
อ่านค่า variation ที่ถูก assign ในโค้ด
หัวข้อที่มีชื่อว่า “อ่านค่า variation ที่ถูก assign ในโค้ด”snippet ด้านล่างแสดงรูปแบบขั้นต่ำ: initialize SDK แล้วเรียก getFeatureValue พร้อม experiment feature key และ fallback value เป็น 'control' จากนั้น branch ตามผลลัพธ์เพื่อส่งมอบประสบการณ์ที่ถูกต้อง
import { GrowthBook } from '@growthbook/growthbook';
const gb = new GrowthBook({
apiHost: 'https://cdn.growthbook.io',
clientKey: 'sdk-YOUR_KEY',
// Pass stable attributes so assignment is deterministic
attributes: {
id: currentUser.id,
},
});
await gb.init({ timeout: 2000 });
// Returns the variation assigned to this user, or 'control' as fallback
const variation = gb.getFeatureValue('experiment-key', 'control');
if (variation === 'treatment') {
// Show the new experience
renderTreatment();
} else {
// Show the original control experience
renderControl();
}