0

[iOS] Adding histograms to Tips (Magic Stack)

This CL creates and logs metrics for Tips (Magic Stack). These
histograms log which tip is displayed and which tip users interact
with.

Bug: 375624617, 369457289
Change-Id: Iea73837383acf09cd660795f13b3c758f05b8e68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5957055
Reviewed-by: Benjamin Williams <bwwilliams@google.com>
Reviewed-by: Ginny Huang <ginnyhuang@chromium.org>
Commit-Queue: Briana McClure <bmcclure@google.com>
Cr-Commit-Position: refs/heads/main@{#1374678}
This commit is contained in:
Briana McClure
2024-10-28 16:51:32 +00:00
committed by Chromium LUCI CQ
parent a537192436
commit 9ea0ebde03
6 changed files with 68 additions and 2 deletions
ios/chrome/browser/ui/content_suggestions
tools/metrics/histograms

@ -10,6 +10,7 @@
#import "base/apple/foundation_util.h"
#import "base/ios/ios_util.h"
#import "base/memory/raw_ptr.h"
#import "base/metrics/histogram_functions.h"
#import "base/metrics/histogram_macros.h"
#import "base/metrics/user_metrics.h"
#import "base/metrics/user_metrics_action.h"
@ -145,6 +146,7 @@
#import "ios/chrome/browser/ui/content_suggestions/set_up_list/utils.h"
#import "ios/chrome/browser/ui/content_suggestions/tab_resumption/tab_resumption_mediator.h"
#import "ios/chrome/browser/ui/content_suggestions/tips/tips_magic_stack_mediator.h"
#import "ios/chrome/browser/ui/content_suggestions/tips/tips_metrics.h"
#import "ios/chrome/browser/ui/content_suggestions/tips/tips_module_state.h"
#import "ios/chrome/browser/ui/content_suggestions/tips/tips_passwords_coordinator.h"
#import "ios/chrome/browser/ui/content_suggestions/tips/tips_prefs.h"
@ -619,8 +621,8 @@ using segmentation_platform::TipIdentifier;
CHECK(IsTipsMagicStackEnabled());
CHECK(_tipsMediator);
// TODO(crbug.com/369457289): Track user interactions with the Tips module
// using new metrics.
// Log the Tips (Magic Stack) Module that the user tapped on.
base::UmaHistogramEnumeration(kTipsMagicStackModuleTappedTypeHistogram, tip);
switch (tip) {
case TipIdentifier::kUnknown:
NOTREACHED();
@ -768,6 +770,10 @@ using segmentation_platform::TipIdentifier;
OutputLabelForTipIdentifier(_tipsMediator.state.identifier);
if (name.has_value()) {
registry->NotifyCardShown(std::string(name.value()).c_str());
// Log the Tips (Magic Stack) Module that was displayed to the user.
base::UmaHistogramEnumeration(
kTipsMagicStackModuleDisplayedTypeHistogram,
_tipsMediator.state.identifier);
break;
}
[[fallthrough]];

@ -7,6 +7,8 @@ source_set("tips") {
"tips_magic_stack_consumer.h",
"tips_magic_stack_mediator.h",
"tips_magic_stack_mediator.mm",
"tips_metrics.cc",
"tips_metrics.h",
"tips_module_audience.h",
"tips_module_consumer_source.h",
"tips_module_state.h",

@ -0,0 +1,11 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/content_suggestions/tips/tips_metrics.h"
const char kTipsMagicStackModuleDisplayedTypeHistogram[] =
"IOS.TipsMagicStack.Module.DisplayedType";
const char kTipsMagicStackModuleTappedTypeHistogram[] =
"IOS.TipsMagicStack.Module.TappedType";

@ -0,0 +1,16 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_TIPS_TIPS_METRICS_H_
#define IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_TIPS_TIPS_METRICS_H_
// UMA histogram names.
// Logged when Tips (Magic Stack) is displayed for a user. The enumeration
// indicates which tip was displayed.
extern const char kTipsMagicStackModuleDisplayedTypeHistogram[];
// Logged when the user taps on the Tips (Magic Stack) module. The enumeration
// indicates which tip was interacted with.
extern const char kTipsMagicStackModuleTappedTypeHistogram[];
#endif // IOS_CHROME_BROWSER_UI_CONTENT_SUGGESTIONS_TIPS_TIPS_METRICS_H_

@ -32516,6 +32516,17 @@ Called by update_net_error_codes.py.-->
<int value="3" label="Request is cancelled."/>
</enum>
<enum name="TipIdentifier">
<int value="0" label="Unknown"/>
<int value="1" label="LensSearch"/>
<int value="2" label="LensShop"/>
<int value="3" label="LensTranslate"/>
<int value="4" label="AddressBarPosition"/>
<int value="5" label="SavePasswords"/>
<int value="6" label="AutofillPasswords"/>
<int value="7" label="EnhancedSafeBrowsing"/>
</enum>
<enum name="TokenStateOnRegistrationRequest">
<int value="0" label="Token was empty"/>
<int value="1" label="Token stayed unchanged"/>

@ -4972,6 +4972,26 @@ the generic promo launch. -->
</summary>
</histogram>
<histogram name="IOS.TipsMagicStack.Module.DisplayedType" enum="TipIdentifier"
expires_after="2025-04-22">
<owner>bmcclure@google.com</owner>
<owner>bwwilliams@google.com</owner>
<summary>
Logged when Tips (Magic Stack) is disaplyed for a user. The enumeration
indicates which tip was displayed.
</summary>
</histogram>
<histogram name="IOS.TipsMagicStack.Module.TappedType" enum="TipIdentifier"
expires_after="2025-04-22">
<owner>bmcclure@google.com</owner>
<owner>bwwilliams@google.com</owner>
<summary>
Logged when the user taps on the Tips (Magic Stack) module. The enumeration
indicates which tip was interacted with.
</summary>
</histogram>
<histogram name="IOS.Translate.PageLoad.LanguageDetectionMethod"
enum="LanguageDetectionMethod" expires_after="2023-03-24">
<owner>olivierrobin@chromium.org</owner>