From 781dd16c44497840e1bbf23ab2f569ebb313f676 Mon Sep 17 00:00:00 2001 From: Matthew Kevins Date: Wed, 14 Feb 2024 16:26:29 +1000 Subject: [PATCH 1/3] Add tracking event for notifications inline actions --- .../java/org/wordpress/android/analytics/AnalyticsTracker.java | 1 + .../org/wordpress/android/analytics/AnalyticsTrackerNosara.java | 2 ++ 2 files changed, 3 insertions(+) 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 1ff40457f641..550a8ce13999 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 @@ -1109,6 +1109,7 @@ public enum Stat { SITE_MONITORING_TAB_LOADING_ERROR, NOTIFICATION_MENU_TAPPED, NOTIFICATIONS_MARK_ALL_READ_TAPPED, + NOTIFICATIONS_INLINE_ACTION_TAPPED, WEBVIEW_TOO_LARGE_PAYLOAD_ERROR, } diff --git a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java index 540c90c0afa4..5a0198466930 100644 --- a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java +++ b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java @@ -2711,6 +2711,8 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) { return "notification_menu_tapped"; case NOTIFICATIONS_MARK_ALL_READ_TAPPED: return "notifications_mark_all_read_tapped"; + case NOTIFICATIONS_INLINE_ACTION_TAPPED: + return "notifications_inline_action_tapped"; case WEBVIEW_TOO_LARGE_PAYLOAD_ERROR: return "webview_too_large_payload_error"; } From 70bb7ba1f37add1140059045beed24dbd750b7bb Mon Sep 17 00:00:00 2001 From: Matthew Kevins Date: Wed, 14 Feb 2024 16:27:41 +1000 Subject: [PATCH 2/3] Track inline action events for notifications --- .../ui/notifications/NotificationsListFragmentPage.kt | 8 ++++++++ .../ui/notifications/NotificationsListViewModel.kt | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListFragmentPage.kt b/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListFragmentPage.kt index 1948ca3ccf90..b13ab6fb7a89 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListFragmentPage.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListFragmentPage.kt @@ -26,6 +26,7 @@ import org.wordpress.android.BuildConfig import org.wordpress.android.R import org.wordpress.android.WordPress import org.wordpress.android.analytics.AnalyticsTracker.Stat.APP_REVIEWS_EVENT_INCREMENTED_BY_CHECKING_NOTIFICATION +import org.wordpress.android.analytics.AnalyticsTracker.Stat.NOTIFICATIONS_INLINE_ACTION_TAPPED import org.wordpress.android.databinding.NotificationsListFragmentPageBinding import org.wordpress.android.datasets.NotificationsTable import org.wordpress.android.fluxc.model.CommentStatus @@ -62,6 +63,7 @@ import org.wordpress.android.util.AppLog.T import org.wordpress.android.util.DisplayUtils import org.wordpress.android.util.NetworkUtils import org.wordpress.android.util.WPSwipeToRefreshHelper +import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper import org.wordpress.android.util.helpers.SwipeToRefreshHelper import org.wordpress.android.widgets.AppRatingDialog.incrementInteractions import javax.inject.Inject @@ -83,6 +85,9 @@ class NotificationsListFragmentPage : ViewPagerFragment(R.layout.notifications_l @Inject lateinit var gcmMessageHandler: GCMMessageHandler + @Inject + lateinit var analyticsTrackerWrapper: AnalyticsTrackerWrapper + private val showNewUnseenNotificationsRunnable = Runnable { if (isAdded) { binding?.notificationsList?.addOnScrollListener(mOnScrollListener) @@ -421,6 +426,9 @@ class NotificationsListFragmentPage : ViewPagerFragment(R.layout.notifications_l } private fun handleInlineActionEvent(actionEvent: InlineActionEvent) { + analyticsTrackerWrapper.track(NOTIFICATIONS_INLINE_ACTION_TAPPED, mapOf( + InlineActionEvent.KEY_INLINE_ACTION to actionEvent::class.simpleName + )) when (actionEvent) { is SharePostButtonTapped -> actionEvent.notification.let { postNotification -> context?.let { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt index 6299411f80d2..2a3628ff342c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt @@ -83,5 +83,9 @@ class NotificationsListViewModel @Inject constructor( sealed class InlineActionEvent { data class SharePostButtonTapped(val notification: PostNotification): InlineActionEvent() + + companion object { + val KEY_INLINE_ACTION = "inline_action" + } } } From 9ca2497a17b940888c8087f226202e8196ce5b88 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 15 Feb 2024 15:32:28 +0200 Subject: [PATCH 3/3] Update WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt Fixes detekt issue --- .../android/ui/notifications/NotificationsListViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt index 2a3628ff342c..342baf99e206 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/notifications/NotificationsListViewModel.kt @@ -85,7 +85,7 @@ class NotificationsListViewModel @Inject constructor( data class SharePostButtonTapped(val notification: PostNotification): InlineActionEvent() companion object { - val KEY_INLINE_ACTION = "inline_action" + const val KEY_INLINE_ACTION = "inline_action" } } }