Skip to content

Commit

Permalink
Merge pull request wordpress-mobile#21360 from wordpress-mobile/issue…
Browse files Browse the repository at this point in the history
…/21348-feedback-form-analytics-update

Match iOS Feedback Form Tracks Events
  • Loading branch information
nbradbury authored Oct 25, 2024
2 parents da5752d + 0543e0b commit 8a2723a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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) { _, _ ->
Expand All @@ -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()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8a2723a

Please sign in to comment.