Skip to content

Commit 58af0b5

Browse files
Merge pull request #8172 from woocommerce/feature/tracking_profiler_steps
Feature/tracking profiler steps
2 parents 17a4cdc + fe3451b commit 58af0b5

14 files changed

+79
-28
lines changed

RELEASE-NOTES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22
11.9
33
-----
4-
4+
- [**] Adds new profiler steps to store creation flow [https://github.com/woocommerce/woocommerce-android/pull/8097]
5+
- [**] Adds country picker step to store creation flow [https://github.com/woocommerce/woocommerce-android/pull/8167]
56

67
11.8
8+
-----
79
- [*] Add variations bottom sheet is fully visible right after showing up in the landscape mode [https://github.com/woocommerce/woocommerce-android/pull/8043]
810
- [*] UI improvements to the products on the analytics screen [https://github.com/woocommerce/woocommerce-android/pull/8098]
911
- [*] Add a feature of replying to customer reviews [https://github.com/woocommerce/woocommerce-android/pull/8045]

WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,7 @@ enum class AnalyticsEvent(val siteless: Boolean = false) {
779779
SITE_CREATION_IAP_ELIGIBILITY_ERROR(siteless = true),
780780
SITE_CREATION_IAP_PURCHASE_SUCCESS(siteless = true),
781781
SITE_CREATION_IAP_PURCHASE_ERROR(siteless = true),
782+
SITE_CREATION_PROFILER_DATA,
782783

783784
APPLICATION_PASSWORDS_NEW_PASSWORD_CREATED,
784785
APPLICATION_PASSWORDS_NOT_AVAILABLE,

WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsTracker.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ class AnalyticsTracker private constructor(private val context: Context) {
189189
const val KEY_CUSTOM_FIELDS_SIZE = "custom_fields_size"
190190
const val KEY_WAITING_TIME = "waiting_time"
191191
const val KEY_IS_NON_ATOMIC = "is_non_atomic"
192+
const val KEY_INDUSTRY_GROUP = "industry_group"
193+
const val KEY_INDUSTRY = "industry"
194+
const val KEY_USER_COMMERCE_JOURNEY = "user_commerce_journey"
195+
const val KEY_ECOMMERCE_PLATFORMS = "ecommerce_platforms"
196+
const val KEY_COUNTRY_CODE = "country_code"
192197

193198
const val KEY_SORT_ORDER = "order"
194199
const val VALUE_SORT_NAME_ASC = "name,ascending"

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/storecreation/NewStore.kt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ class NewStore @Inject constructor() {
1111
fun update(
1212
name: String? = null,
1313
domain: String? = null,
14-
industry: String? = null,
15-
commerceJourney: String? = null,
16-
eCommercePlatform: String? = null,
14+
profilerData: ProfilerData? = null,
1715
country: Country? = null,
1816
siteId: Long? = null,
1917
planProductId: Int? = null,
@@ -22,9 +20,7 @@ class NewStore @Inject constructor() {
2220
data = data.copy(
2321
name = name ?: data.name,
2422
domain = domain ?: data.domain,
25-
industry = industry ?: data.industry,
26-
userJourney = commerceJourney ?: data.userJourney,
27-
platform = eCommercePlatform ?: data.platform,
23+
profilerData = profilerData ?: data.profilerData,
2824
country = country ?: data.country,
2925
siteId = siteId ?: data.siteId,
3026
planProductId = planProductId ?: data.planProductId,
@@ -39,9 +35,7 @@ class NewStore @Inject constructor() {
3935
data class NewStoreData(
4036
val name: String? = null,
4137
val domain: String? = null,
42-
val industry: String? = null,
43-
val userJourney: String? = null,
44-
val platform: String? = null,
38+
val profilerData: ProfilerData? = null,
4539
val country: Country? = null,
4640
val siteId: Long? = null,
4741
val planProductId: Int? = null,
@@ -52,4 +46,12 @@ class NewStore @Inject constructor() {
5246
val name: String,
5347
val code: String,
5448
)
49+
50+
data class ProfilerData(
51+
val industryLabel: String? = null,
52+
val industryKey: String? = null,
53+
val industryGroupKey: String? = null,
54+
val userCommerceJourneyKey: String? = null,
55+
val eCommercePlatformKey: String? = null,
56+
)
5557
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/storecreation/mystoresummary/MyStoreSummaryViewModel.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MyStoreSummaryViewModel @Inject constructor(
2626
MyStoreSummaryState(
2727
name = newStore.data.name,
2828
domain = newStore.data.domain ?: "",
29-
industry = newStore.data.industry,
29+
industry = newStore.data.profilerData?.industryLabel,
3030
country = Country(
3131
name = newStore.data.country?.name ?: "",
3232
emojiFlag = emojiUtils.countryCodeToEmojiFlag(newStore.data.country?.code ?: "")
@@ -41,6 +41,18 @@ class MyStoreSummaryViewModel @Inject constructor(
4141
AnalyticsTracker.KEY_STEP to AnalyticsTracker.VALUE_STEP_STORE_SUMMARY
4242
)
4343
)
44+
45+
val newStoreProfilerData = newStore.data.profilerData
46+
analyticsTrackerWrapper.track(
47+
stat = AnalyticsEvent.SITE_CREATION_PROFILER_DATA,
48+
properties = mapOf(
49+
AnalyticsTracker.KEY_INDUSTRY_GROUP to newStoreProfilerData?.industryGroupKey,
50+
AnalyticsTracker.KEY_INDUSTRY to newStoreProfilerData?.industryKey,
51+
AnalyticsTracker.KEY_USER_COMMERCE_JOURNEY to newStoreProfilerData?.userCommerceJourneyKey,
52+
AnalyticsTracker.KEY_ECOMMERCE_PLATFORMS to newStoreProfilerData?.eCommercePlatformKey,
53+
AnalyticsTracker.KEY_COUNTRY_CODE to newStore.data.country?.code,
54+
)
55+
)
4456
}
4557

4658
fun onBackPressed() {

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/storecreation/name/StoreNamePickerFragment.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import com.woocommerce.android.extensions.navigateToHelpScreen
1313
import com.woocommerce.android.ui.base.BaseFragment
1414
import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground
1515
import com.woocommerce.android.ui.main.AppBarStatus
16-
import com.woocommerce.android.util.FeatureFlag
1716
import com.woocommerce.android.viewmodel.MultiLiveEvent
1817
import dagger.hilt.android.AndroidEntryPoint
1918

@@ -51,11 +50,8 @@ class StoreNamePickerFragment : BaseFragment() {
5150
}
5251

5352
private fun navigateToStoreProfilerCategoryFragment() {
54-
val directions = if (FeatureFlag.STORE_PROFILER_FLOW.isEnabled()) {
53+
findNavController().navigateSafely(
5554
StoreNamePickerFragmentDirections.actionStoreNamePickerFragmentToStoreProfilerCategoryFragment()
56-
} else {
57-
StoreNamePickerFragmentDirections.actionStoreNamePickerFragmentToDomainPickerFragment()
58-
}
59-
findNavController().navigateSafely(directions)
55+
)
6056
}
6157
}

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/storecreation/profiler/BaseStoreProfilerViewModel.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ abstract class BaseStoreProfilerViewModel(
7575
@Parcelize
7676
data class StoreProfilerOptionUi(
7777
val name: String,
78+
val key: String,
7879
val isSelected: Boolean,
7980
) : Parcelable
8081

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/storecreation/profiler/ProfilerOptionsModel.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ data class AboutMerchant(
1010
val value: String,
1111
val heading: String,
1212
val description: String,
13-
val platforms: List<Platform>?
13+
val tracks: String,
14+
val platforms: List<Platform>?,
1415
)
1516

1617
data class Platform(
@@ -21,5 +22,6 @@ data class Platform(
2122
data class Industry(
2223
val id: String,
2324
val label: String,
24-
val key: String
25+
val key: String,
26+
val tracks: String
2527
)

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/storecreation/profiler/StoreProfilerCommerceJourneyViewModel.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ class StoreProfilerCommerceJourneyViewModel @Inject constructor(
4747
resourceProvider.getString(R.string.store_creation_store_profiler_journey_title)
4848

4949
override fun onContinueClicked() {
50-
newStore.update(commerceJourney = profilerOptions.value.firstOrNull() { it.isSelected }?.name)
50+
newStore.update(
51+
profilerData = (newStore.data.profilerData ?: NewStore.ProfilerData())
52+
.copy(
53+
userCommerceJourneyKey = profilerOptions.value.firstOrNull { it.isSelected }?.key
54+
)
55+
)
5156
when (alreadySellingOnlineSelected()) {
5257
true -> triggerEvent(NavigateToEcommercePlatformsStep)
5358
false -> triggerEvent(NavigateToCountryPickerStep)
@@ -56,7 +61,8 @@ class StoreProfilerCommerceJourneyViewModel @Inject constructor(
5661

5762
private fun AboutMerchant.toStoreProfilerOptionUi() = StoreProfilerOptionUi(
5863
name = value,
59-
isSelected = newStore.data.industry == value,
64+
key = tracks,
65+
isSelected = newStore.data.profilerData?.eCommercePlatformKey == tracks,
6066
)
6167

6268
private fun alreadySellingOnlineSelected() = profilerOptions.value

WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/storecreation/profiler/StoreProfilerEcommercePlatformsViewModel.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class StoreProfilerEcommercePlatformsViewModel @Inject constructor(
4141
private fun Platform.toStoreProfilerOptionUi() =
4242
StoreProfilerOptionUi(
4343
name = label,
44-
isSelected = newStore.data.industry == label
44+
key = value,
45+
isSelected = newStore.data.profilerData?.eCommercePlatformKey == value
4546
)
4647

4748
override fun getProfilerStepDescription(): String =
@@ -51,7 +52,12 @@ class StoreProfilerEcommercePlatformsViewModel @Inject constructor(
5152
resourceProvider.getString(R.string.store_creation_store_profiler_platforms_title)
5253

5354
override fun onContinueClicked() {
54-
newStore.update(eCommercePlatform = profilerOptions.value.firstOrNull() { it.isSelected }?.name)
55+
newStore.update(
56+
profilerData = (newStore.data.profilerData ?: NewStore.ProfilerData())
57+
.copy(
58+
eCommercePlatformKey = profilerOptions.value.firstOrNull { it.isSelected }?.key
59+
)
60+
)
5561
triggerEvent(NavigateToCountryPickerStep)
5662
}
5763
}

0 commit comments

Comments
 (0)