Skip to content

Commit da4b484

Browse files
authored
Merge pull request #11066 from wordpress-mobile/issue/1718-track-gutenberg-rollout-v2
Analytics: Track phase 2 of the Gutenberg Rollout
2 parents 0d43e01 + 25536d1 commit da4b484

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

WordPress/src/main/java/org/wordpress/android/util/SiteUtils.java

+21-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ public static void migrateAppWideMobileEditorPreferenceToRemote(final AccountSto
7777
}
7878
}
7979

80-
// Enable Gutenberg for all sites using a single network call
80+
// Track and enable Gutenberg for all sites using a single network call. Ideally we would track this
81+
// on the network response, but this would make this rollout even more complex.
82+
// There might be some rare events when we register a site switched to Gutenberg which is actually
83+
// still on Aztec.
84+
trackGutenbergEnabledForNonGutenbergSites(siteStore,
85+
BlockEditorEnabledSource.ON_PROGRESSIVE_ROLLOUT_PHASE_2);
8186
dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorForAllSitesAction(
8287
new DesignateMobileEditorForAllSitesPayload(SiteUtils.GB_EDITOR_NAME, false)));
8388

@@ -114,7 +119,12 @@ public static void migrateAppWideMobileEditorPreferenceToRemote(final AccountSto
114119
}
115120
}
116121

117-
// Enable Gutenberg for all sites using a single network call
122+
// Track and enable and Gutenberg for all sites using a single network call. Ideally we would track this
123+
// on the network response, but this would make this rollout even more complex.
124+
// There might be some rare events when we register a site switched to Gutenberg which is actually
125+
// still on Aztec.
126+
trackGutenbergEnabledForNonGutenbergSites(siteStore,
127+
BlockEditorEnabledSource.ON_PROGRESSIVE_ROLLOUT_PHASE_1);
118128
dispatcher.dispatch(SiteActionBuilder.newDesignateMobileEditorForAllSitesAction(
119129
new DesignateMobileEditorForAllSitesPayload(SiteUtils.GB_EDITOR_NAME)));
120130

@@ -136,6 +146,15 @@ public static void migrateAppWideMobileEditorPreferenceToRemote(final AccountSto
136146
}
137147
}
138148

149+
private static void trackGutenbergEnabledForNonGutenbergSites(final SiteStore siteStore,
150+
final BlockEditorEnabledSource source) {
151+
for (SiteModel site : siteStore.getSites()) {
152+
if (!TextUtils.equals(site.getMobileEditor(), GB_EDITOR_NAME)) {
153+
AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_GUTENBERG_ENABLED, site, source.asPropertyMap());
154+
}
155+
}
156+
}
157+
139158
private static boolean atLeastOneSiteHasAztecEnabled(final SiteStore siteStore) {
140159
// We want to make sure to enable Gutenberg only on the sites they didn't opt-out.
141160
for (SiteModel site : siteStore.getSites()) {

WordPress/src/main/java/org/wordpress/android/util/analytics/AnalyticsUtils.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public enum BlockEditorEnabledSource {
7474
VIA_SITE_SETTINGS,
7575
ON_SITE_CREATION,
7676
ON_BLOCK_POST_OPENING,
77-
ON_PROGRESSIVE_ROLLOUT;
77+
ON_PROGRESSIVE_ROLLOUT_PHASE_1,
78+
ON_PROGRESSIVE_ROLLOUT_PHASE_2;
7879

7980
public Map<String, Object> asPropertyMap() {
8081
Map<String, Object> properties = new HashMap<>();

0 commit comments

Comments
 (0)