Commit 0d4a6638 authored by David Black's avatar David Black Committed by Commit Bot

Record the time when an item was first added to holding space.

Previously we were only recording the time of the user's first pin to
holding space. Now we will record the time when the first item of any
type was added to holding space.

This should help determine how discoverable the feature is.

Bug: 1131266
Change-Id: Iacee3d00345fa2860b34d7695d92bf3e0bf91485
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2530751Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#827033}
parent 618e202b
...@@ -96,6 +96,15 @@ void RecordItemCounts(const std::vector<const HoldingSpaceItem*>& items) { ...@@ -96,6 +96,15 @@ void RecordItemCounts(const std::vector<const HoldingSpaceItem*>& items) {
} }
} }
void RecordTimeFromFirstAvailabilityToFirstAdd(base::TimeDelta time_delta) {
// NOTE: 24 days appears to be the max supported number of days.
base::UmaHistogramCustomTimes(
"HoldingSpace.TimeFromFirstAvailabilityToFirstAdd", time_delta,
/*min=*/base::TimeDelta::FromMinutes(1),
/*max=*/base::TimeDelta::FromDays(24),
/*buckets=*/50);
}
void RecordTimeFromFirstAvailabilityToFirstEntry(base::TimeDelta time_delta) { void RecordTimeFromFirstAvailabilityToFirstEntry(base::TimeDelta time_delta) {
// NOTE: 24 days appears to be the max supported number of days. // NOTE: 24 days appears to be the max supported number of days.
base::UmaHistogramCustomTimes( base::UmaHistogramCustomTimes(
......
...@@ -68,6 +68,11 @@ ASH_PUBLIC_EXPORT void RecordItemAction( ...@@ -68,6 +68,11 @@ ASH_PUBLIC_EXPORT void RecordItemAction(
ASH_PUBLIC_EXPORT void RecordItemCounts( ASH_PUBLIC_EXPORT void RecordItemCounts(
const std::vector<const HoldingSpaceItem*>& items); const std::vector<const HoldingSpaceItem*>& items);
// Records time from the first availability of the holding space feature to the
// first item being added to holding space.
ASH_PUBLIC_EXPORT void RecordTimeFromFirstAvailabilityToFirstAdd(
base::TimeDelta time_delta);
// Records time from first availability to the first entry into holding space. // Records time from first availability to the first entry into holding space.
ASH_PUBLIC_EXPORT void RecordTimeFromFirstAvailabilityToFirstEntry( ASH_PUBLIC_EXPORT void RecordTimeFromFirstAvailabilityToFirstEntry(
base::TimeDelta time_delta); base::TimeDelta time_delta);
......
...@@ -48,6 +48,18 @@ ProfileManager* GetProfileManager() { ...@@ -48,6 +48,18 @@ ProfileManager* GetProfileManager() {
return g_browser_process->profile_manager(); return g_browser_process->profile_manager();
} }
// Records the time from the first availability of the holding space feature
// to the time of the first item being added into holding space.
void RecordTimeFromFirstAvailabilityToFirstAdd(Profile* profile) {
base::Time time_of_first_availability =
holding_space_prefs::GetTimeOfFirstAvailability(profile->GetPrefs())
.value();
base::Time time_of_first_add =
holding_space_prefs::GetTimeOfFirstAdd(profile->GetPrefs()).value();
holding_space_metrics::RecordTimeFromFirstAvailabilityToFirstAdd(
time_of_first_add - time_of_first_availability);
}
// Records the time from the first entry to the first pin into holding space. // Records the time from the first entry to the first pin into holding space.
// Note that this time may be zero if the user pinned their first file before // Note that this time may be zero if the user pinned their first file before
// having ever entered holding space. // having ever entered holding space.
...@@ -248,9 +260,10 @@ void HoldingSpaceKeyedService::AddScreenRecording( ...@@ -248,9 +260,10 @@ void HoldingSpaceKeyedService::AddScreenRecording(
void HoldingSpaceKeyedService::AddItem(std::unique_ptr<HoldingSpaceItem> item) { void HoldingSpaceKeyedService::AddItem(std::unique_ptr<HoldingSpaceItem> item) {
// Mark the time when the user's first item was added to holding space. Note // Mark the time when the user's first item was added to holding space. Note
// that this no-ops if this is not the user's first time adding an item. // that true is returned iff this is in fact the user's first add and, if so,
// TODO(crbug.com/1131266): Record histogram. // the time it took for the user to add their first item should be recorded.
holding_space_prefs::MarkTimeOfFirstAdd(profile_->GetPrefs()); if (holding_space_prefs::MarkTimeOfFirstAdd(profile_->GetPrefs()))
RecordTimeFromFirstAvailabilityToFirstAdd(profile_);
holding_space_model_.AddItem(std::move(item)); holding_space_model_.AddItem(std::move(item));
} }
......
...@@ -75,6 +75,16 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -75,6 +75,16 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="HoldingSpace.TimeFromFirstAvailabilityToFirstAdd" units="ms"
expires_after="2021-09-24">
<owner>dmblack@google.com</owner>
<owner>gzadina@google.com</owner>
<summary>
Records the time from when the holding space feature first became available
to when the user first added an item to holding space.
</summary>
</histogram>
<histogram name="HoldingSpace.TimeFromFirstAvailabilityToFirstEntry" units="ms" <histogram name="HoldingSpace.TimeFromFirstAvailabilityToFirstEntry" units="ms"
expires_after="2021-09-24"> expires_after="2021-09-24">
<owner>dmblack@google.com</owner> <owner>dmblack@google.com</owner>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment