Skip to content

Commit

Permalink
Add tracks for blaze objective screen
Browse files Browse the repository at this point in the history
  • Loading branch information
irfano committed Oct 17, 2024
1 parent 2a3033f commit 03c32c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv
BLAZE_CREATION_EDIT_LOCATION_SAVE_TAPPED,
BLAZE_CREATION_EDIT_DESTINATION_SAVE_TAPPED,
BLAZE_CAMPAIGN_CREATION_FEEDBACK,
BLAZE_CAMPAIGN_OBJECTIVE_SAVED,

// Hazmat Shipping Declaration
CONTAINS_HAZMAT_CHECKED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ class AnalyticsTracker private constructor(
const val KEY_BLAZE_IS_AI_CONTENT = "is_ai_suggested_ad_content"
const val KEY_BLAZE_ERROR = "blaze_creation_error"
const val KEY_BLAZE_CAMPAIGN_TYPE = "campaign_type"
const val KEY_BLAZE_OBJECTIVE = "objective"

const val PRODUCT_TYPES = "product_types"
const val HAS_ADDONS = "has_addons"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import android.os.Parcelable
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.asLiveData
import androidx.lifecycle.viewModelScope
import com.woocommerce.android.analytics.AnalyticsEvent.BLAZE_CAMPAIGN_OBJECTIVE_SAVED
import com.woocommerce.android.analytics.AnalyticsTracker
import com.woocommerce.android.analytics.AnalyticsTrackerWrapper
import com.woocommerce.android.ui.blaze.BlazeRepository
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.Exit
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.ExitWithResult
Expand All @@ -23,6 +26,7 @@ import javax.inject.Inject
class BlazeCampaignObjectiveViewModel @Inject constructor(
private val blazeRepository: BlazeRepository,
savedStateHandle: SavedStateHandle,
private val analyticsTrackerWrapper: AnalyticsTrackerWrapper
) : ScopedViewModel(savedStateHandle) {
private val navArgs: BlazeCampaignObjectiveFragmentArgs by savedStateHandle.navArgs()

Expand Down Expand Up @@ -74,6 +78,9 @@ class BlazeCampaignObjectiveViewModel @Inject constructor(
}
selectedId.value?.let {
triggerEvent(ExitWithResult(ObjectiveResult(it)))
analyticsTrackerWrapper.track(
stat = BLAZE_CAMPAIGN_OBJECTIVE_SAVED,
properties = mapOf(AnalyticsTracker.KEY_BLAZE_OBJECTIVE to it)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ class BlazeCampaignCreationPreviewViewModel @Inject constructor(
AnalyticsTracker.VALUE_EVERGREEN_CAMPAIGN

else -> AnalyticsTracker.VALUE_START_END_CAMPAIGN
}
},
AnalyticsTracker.KEY_BLAZE_OBJECTIVE to campaignDetails.value?.objectiveId,
)
)
campaignDetails.value?.let {
Expand Down

0 comments on commit 03c32c0

Please sign in to comment.