0

[iOS] Add Docking Promo histograms.

This change introduces new histograms to better understand:

1. When the Docking Promo loses to another promo, which promo(s) is it
commonly losing to?

2. What's the typical last app foregrounding time for users when
evaluating Docking Promo trigger criteria?

Change-Id: I8bd068ec22b9a33acaed01c56711593f01d694ef
Bug: 331207599
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5392103
Reviewed-by: Hira Mahmood <hiramahmood@google.com>
Reviewed-by: Robbie Gibson <rkgibson@google.com>
Commit-Queue: Benjamin Williams <bwwilliams@google.com>
Reviewed-by: Ali Juma <ajuma@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1277886}
This commit is contained in:
Benjamin Williams
2024-03-25 20:13:39 +00:00
committed by Chromium LUCI CQ
parent ef483f6619
commit 22f0bb341b
3 changed files with 78 additions and 0 deletions
ios/chrome/browser
docking_promo
promos_manager
tools/metrics/histograms/metadata/ios

@ -6,13 +6,25 @@
#import <optional>
#import "base/feature_list.h"
#import "base/metrics/histogram_macros.h"
#import "base/strings/sys_string_conversions.h"
#import "base/time/time.h"
#import "ios/chrome/browser/default_browser/model/utils.h"
#import "ios/chrome/browser/promos_manager/model/constants.h"
#import "ios/chrome/browser/shared/model/utils/first_run_util.h"
#import "ios/chrome/browser/shared/public/features/features.h"
#import "ios/chrome/browser/shared/public/features/system_flags.h"
namespace {
// Killswitch to control new DockingPromo histograms.
BASE_FEATURE(kDockingPromoHistogramKillswitch,
"DockingPromoHistogramKillswitch",
base::FEATURE_ENABLED_BY_DEFAULT);
} // namespace
BOOL IsDockingPromoForcedForDisplay() {
NSString* forced_promo_name = experimental_flags::GetForcedPromoToDisplay();
@ -32,6 +44,15 @@ BOOL IsDockingPromoForcedForDisplay() {
}
BOOL CanShowDockingPromo(base::TimeDelta time_since_last_foreground) {
// TODO(crbug.com/330387623): Cleanup Docking Promo histograms.
if (base::FeatureList::IsEnabled(kDockingPromoHistogramKillswitch)) {
// Logs the time since last foreground over a range of 2 weeks.
UMA_HISTOGRAM_CUSTOM_COUNTS(
"IOS.DockingPromo.LastForegroundTimeViaAppState",
time_since_last_foreground.InMinutes(), 1, base::Days(14).InMinutes(),
100);
}
if (IsDockingPromoForcedForDisplay()) {
return YES;
}

@ -38,6 +38,11 @@ BASE_FEATURE(kPromosManagerDockingPromoSortKillswitch,
"PromosManagerDockingPromoSortKillswitch",
base::FEATURE_ENABLED_BY_DEFAULT);
// Killswitch to control new DockingPromo histograms.
BASE_FEATURE(kPromosManagerDockingPromoHistogramsKillswitch,
"PromosManagerDockingPromoHistogramsKillswitch",
base::FEATURE_ENABLED_BY_DEFAULT);
// Conditionally appends `promo` to the list pref `pref_path`. If `promo`
// already exists in the list pref `pref_path`, does nothing. If `promo` doesn't
// exist in the list pref `pref_path`, appends `promo` to the list.
@ -207,6 +212,22 @@ std::optional<promos_manager::Promo> PromosManagerImpl::NextPromoForDisplay() {
for (promos_manager::Promo promo : sorted_promos) {
if (CanShowPromo(promo)) {
// TODO(crbug.com/330387623): Cleanup Docking Promo histograms.
if (base::FeatureList::IsEnabled(
kPromosManagerDockingPromoHistogramsKillswitch)) {
if (active_promos_with_context.contains(Promo::DockingPromo) &&
promo != Promo::DockingPromo) {
base::UmaHistogramEnumeration("IOS.DockingPromo.LostToCompetingPromo",
promo);
}
if (active_promos_with_context.contains(
Promo::DockingPromoRemindMeLater) &&
promo != Promo::DockingPromoRemindMeLater) {
base::UmaHistogramEnumeration(
"IOS.DockingPromoRemindMeLater.LostToCompetingPromo", promo);
}
}
return promo;
}
}

@ -928,6 +928,42 @@ chromium-metrics-reviews@google.com.
</summary>
</histogram>
<histogram name="IOS.DockingPromo.LastForegroundTimeViaAppState"
units="minutes" expires_after="2024-09-10">
<owner>bwwilliams@google.com</owner>
<owner>hiramahmood@google.com</owner>
<owner>bling-team@google.com</owner>
<summary>
The value represents how long the app was away from the foreground (provided
via AppState) when evaluating whether or not the Docking Promo can be
displayed.
</summary>
</histogram>
<histogram name="IOS.DockingPromo.LostToCompetingPromo"
enum="IOSPromosManagerPromo" expires_after="2024-09-10">
<owner>bwwilliams@google.com</owner>
<owner>hiramahmood@google.com</owner>
<owner>bling-team@google.com</owner>
<summary>
Indicates which promo beat the eligible Docking Promo for display. Logged
once per app launch when deciding which full-screen promo to display, if
any.
</summary>
</histogram>
<histogram name="IOS.DockingPromoRemindMeLater.LostToCompetingPromo"
enum="IOSPromosManagerPromo" expires_after="2024-09-10">
<owner>bwwilliams@google.com</owner>
<owner>hiramahmood@google.com</owner>
<owner>bling-team@google.com</owner>
<summary>
Indicates which promo beat the eligible Docking Promo (Remind Me Later
version) for display. Logged once per app launch when deciding which
full-screen promo to display, if any.
</summary>
</histogram>
<histogram name="IOS.DocumentDownload.ConflictResolution"
enum="DocumentDownloadConflictResolution" expires_after="2025-02-09">
<owner>qpubert@google.com</owner>