Skip to content

Commit 522f829

Browse files
committed
Add tracking for EditorLauncher vs direct Intent launches
Adds a way to distinguish editor launches that went through EditorLauncher vs direct Intent creation for analytics purposes. Changes: - EditorLauncher: Add EXTRA_LAUNCHED_VIA_EDITOR_LAUNCHER intent extra - EditPostActivity: Track EDITOR_LAUNCHED_VIA_EDITOR_LAUNCHER when extra is present (only on initial creation, not configuration changes) - AnalyticsTracker: Add EDITOR_LAUNCHED_VIA_EDITOR_LAUNCHER stat
1 parent 0a8881a commit 522f829

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,11 @@ class EditPostActivity : BaseAppCompatActivity(), EditorFragmentActivity, Editor
526526
super.onCreate(savedInstanceState)
527527
(application as WordPress).component().inject(this)
528528
initializeViewModels()
529+
530+
// Track if this editor launch came via EditorLauncher (only on initial creation)
531+
if (savedInstanceState == null && intent.getBooleanExtra(EditorLauncher.EXTRA_LAUNCHED_VIA_EDITOR_LAUNCHER, false)) {
532+
analyticsTrackerWrapper.track(Stat.EDITOR_LAUNCHED_VIA_EDITOR_LAUNCHER)
533+
}
529534

530535
setContentView(R.layout.new_edit_post_activity)
531536
val callback: OnBackPressedCallback = object : OnBackPressedCallback(true) {

WordPress/src/main/java/org/wordpress/android/ui/posts/EditorLauncher.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class EditorLauncher @Inject constructor(
2626
private val analyticsTrackerWrapper: AnalyticsTrackerWrapper
2727
) {
2828
companion object {
29+
/**
30+
* Intent extra key to indicate the Intent was created through EditorLauncher.
31+
* Used for analytics to distinguish between EditorLauncher and direct Intent creation.
32+
*/
33+
const val EXTRA_LAUNCHED_VIA_EDITOR_LAUNCHER = "launched_via_editor_launcher"
2934
/**
3035
* Static accessor for use in static utility classes like ActivityLauncher.
3136
* Prefer constructor injection when possible.
@@ -88,6 +93,7 @@ class EditorLauncher @Inject constructor(
8893
putExtra(WordPress.SITE, params.site)
8994
putExtra(EditPostActivityConstants.EXTRA_IS_PAGE, params.isPage)
9095
putExtra(EditPostActivityConstants.EXTRA_IS_PROMO, params.isPromo)
96+
putExtra(EXTRA_LAUNCHED_VIA_EDITOR_LAUNCHER, true)
9197
}
9298

9399
private fun Intent.addPostExtras(params: EditorLauncherParams) {

libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public enum Stat {
210210
POST_LIST_VIEW_LAYOUT_TOGGLED,
211211
POST_LIST_SEARCH_ACCESSED,
212212
EDITOR_LAUNCHER,
213+
EDITOR_LAUNCHED_VIA_EDITOR_LAUNCHER,
213214
EDITOR_CLOSED,
214215
EDITOR_SESSION_START,
215216
EDITOR_SESSION_SWITCH_EDITOR,

0 commit comments

Comments
 (0)