From 0543e0be240f53742586f40ec80fd9b9a1492ae7 Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Fri, 25 Oct 2024 10:00:22 -0400 Subject: [PATCH] Track when feedback form is submitted or canceled, rename existing open event to match iOS. --- .../java/org/wordpress/android/ui/ActivityLauncher.java | 3 +-- .../android/ui/main/feedbackform/FeedbackFormViewModel.kt | 7 +++++++ .../org/wordpress/android/analytics/AnalyticsTracker.java | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java b/WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java index 58ffda36dcf1..4ff218801c45 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java @@ -1314,8 +1314,7 @@ public static void viewHelp(@NonNull Context context, @NonNull Origin origin, @N public static void viewFeedbackForm(@NonNull Context context) { warnIfIdentityA8C(context); - // TODO verify tracks event with iOS - AnalyticsTracker.track(Stat.FEEDBACK_FORM_OPENED); + AnalyticsTracker.track(Stat.APP_REVIEWS_FEEDBACK_SCREEN_OPENED); Intent intent = new Intent(context, FeedbackFormActivity.class); context.startActivity(intent); } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/main/feedbackform/FeedbackFormViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/main/feedbackform/FeedbackFormViewModel.kt index 18a9de6cfab7..30c0c5c6b01c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/main/feedbackform/FeedbackFormViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/main/feedbackform/FeedbackFormViewModel.kt @@ -15,6 +15,8 @@ import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.wordpress.android.R +import org.wordpress.android.analytics.AnalyticsTracker.Stat.APP_REVIEWS_FEEDBACK_SENT +import org.wordpress.android.analytics.AnalyticsTracker.Stat.APP_REVIEWS_FEEDBACK_SCREEN_CANCELED import org.wordpress.android.fluxc.utils.AppLogWrapper import org.wordpress.android.modules.UI_THREAD import org.wordpress.android.support.ZendeskHelper @@ -28,6 +30,7 @@ import org.wordpress.android.ui.photopicker.MediaPickerLauncher import org.wordpress.android.util.AppLog.T import org.wordpress.android.util.NetworkUtils import org.wordpress.android.util.ToastUtilsWrapper +import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper import org.wordpress.android.util.extensions.copyToTempFile import org.wordpress.android.util.extensions.fileSize import org.wordpress.android.util.extensions.mimeType @@ -47,6 +50,7 @@ class FeedbackFormViewModel @Inject constructor( private val toastUtilsWrapper: ToastUtilsWrapper, private val feedbackFormUtils: FeedbackFormUtils, private val mediaPickerLauncher: MediaPickerLauncher, + private val analyticsTrackerWrapper: AnalyticsTrackerWrapper, ) : ScopedViewModel(mainDispatcher) { private val _messageText = MutableStateFlow("") val messageText = _messageText.asStateFlow() @@ -172,6 +176,7 @@ class FeedbackFormViewModel @Inject constructor( fun onCloseClick(context: Context) { (context as? Activity)?.let { activity -> if (_messageText.value.isEmpty() && _attachments.value.isEmpty()) { + analyticsTrackerWrapper.track(APP_REVIEWS_FEEDBACK_SCREEN_CANCELED) activity.finish() } else { confirmDiscard(activity) @@ -183,6 +188,7 @@ class FeedbackFormViewModel @Inject constructor( MaterialAlertDialogBuilder(activity).also { builder -> builder.setTitle(R.string.feedback_form_discard) builder.setPositiveButton(R.string.discard) { _, _ -> + analyticsTrackerWrapper.track(APP_REVIEWS_FEEDBACK_SCREEN_CANCELED) activity.finish() } builder.setNegativeButton(R.string.cancel) { _, _ -> @@ -192,6 +198,7 @@ class FeedbackFormViewModel @Inject constructor( } private fun onSuccess(context: Context) { + analyticsTrackerWrapper.track(APP_REVIEWS_FEEDBACK_SENT) showToast(R.string.feedback_form_success) (context as? Activity)?.finish() } diff --git a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java index 9cecd6b3b3da..d8b4ceaa94c8 100644 --- a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java +++ b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java @@ -654,7 +654,13 @@ public enum Stat { SUPPORT_CHATBOT_TICKET_SUCCESS, SUPPORT_CHATBOT_TICKET_FAILURE, SUPPORT_CHATBOT_ENDED, - FEEDBACK_FORM_OPENED, + + // these events are for the feedback form, which on iOS was originally part of the + // in-app review feature. + APP_REVIEWS_FEEDBACK_SCREEN_OPENED, + APP_REVIEWS_FEEDBACK_SENT, + APP_REVIEWS_FEEDBACK_SCREEN_CANCELED, + QUICK_START_STARTED, QUICK_START_CARD_SHOWN, QUICK_START_TAPPED,