Skip to content

Commit e41e118

Browse files
committed
🧪 A/B test Pazu vs Phoebe voice in TTS try modal
Routes Cantonese sample selection to zh-HK_phoebe for the `test` variant of the `tts-try-modal-cantonese-voice` experiment, and stamps `ab_variant` onto open / voice-selected / snoozed / dismissed events so the full funnel can be sliced by variant.
1 parent 6cef0f0 commit e41e118

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎components/TTSTryModal.vue‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ const emit = defineEmits<{
7070
const { t: $t } = useI18n()
7171
const { setTTSLanguageVoice } = useTTSVoice()
7272
73+
const cantoneseVoiceABTest = useABTest({
74+
experimentKey: 'tts-try-modal-cantonese-voice',
75+
})
76+
const isPhoebeVariant = computed(() => cantoneseVoiceABTest.isVariant('test'))
77+
7378
function handleRemindMeLater() {
7479
emit('snooze')
7580
}
@@ -79,12 +84,16 @@ function handleDismiss() {
7984
}
8085
8186
function handleVoiceClick(sample: { id: string, languageVoice: string }) {
82-
const { id: sampleId, languageVoice } = sample
87+
const { id: sampleId, languageVoice: sampleLanguageVoice } = sample
88+
const languageVoice = sampleLanguageVoice === 'zh-HK_pazu' && isPhoebeVariant.value
89+
? 'zh-HK_phoebe'
90+
: sampleLanguageVoice
8391
8492
setTTSLanguageVoice(languageVoice)
8593
useLogEvent('tts_try_voice_selected', {
8694
sample: sampleId,
8795
languageVoice,
96+
ab_variant: cantoneseVoiceABTest.variant.value,
8897
})
8998
emit('voiceSelected', languageVoice)
9099
}
@@ -93,6 +102,7 @@ onMounted(() => {
93102
emit('open')
94103
useLogEvent('tts_try_modal_open', {
95104
nft_class_id: props.nftClassId,
105+
ab_variant: cantoneseVoiceABTest.variant.value,
96106
})
97107
})
98108

‎composables/use-tts-try-modal.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ interface TTSTryModalState {
1111
export function useTTSTryModal() {
1212
const { user } = useUserSession()
1313
const overlay = useOverlay()
14+
const cantoneseVoiceABTest = useABTest({
15+
experimentKey: 'tts-try-modal-cantonese-voice',
16+
})
1417

1518
const state = useStorage<TTSTryModalState>(TTS_TRY_MODAL_KEY, {
1619
shouldOffer: true,
@@ -57,6 +60,7 @@ export function useTTSTryModal() {
5760
useLogEvent('tts_try_voice_selected', {
5861
nft_class_id: options.nftClassId,
5962
languageVoice,
63+
ab_variant: cantoneseVoiceABTest.variant.value,
6064
})
6165
modal.close()
6266
options.onVoiceSelected?.(languageVoice)
@@ -65,6 +69,7 @@ export function useTTSTryModal() {
6569
snoozeTTSTryModal()
6670
useLogEvent('tts_try_snoozed', {
6771
nft_class_id: options.nftClassId,
72+
ab_variant: cantoneseVoiceABTest.variant.value,
6873
})
6974
modal.close()
7075
options.onSnooze?.()
@@ -73,6 +78,7 @@ export function useTTSTryModal() {
7378
dismissTTSTryModal()
7479
useLogEvent('tts_try_dismissed', {
7580
nft_class_id: options.nftClassId,
81+
ab_variant: cantoneseVoiceABTest.variant.value,
7682
})
7783
modal.close()
7884
options.onDismiss?.()

0 commit comments

Comments
 (0)