Skip to content

Commit

Permalink
Remove FIDO settings page opt-in related histograms
Browse files Browse the repository at this point in the history
This CL removes Autofill.BetterAuth.OptInCalled.FromSettingsPage,
Autofill.BetterAuth.OptInPromoShown.FromSettingsPage,
Autofill.BetterAuth.OptInPromoUserDecision.FromSettingsPage as they're
not logged to anymore.

OBSOLETE_HISTOGRAM[Autofill.BetterAuth.OptInCalled.FromSettingsPage]=Removed due to not being used anymore.
OBSOLETE_HISTOGRAM[Autofill.BetterAuth.OptInPromoShown.FromSettingsPage]=Removed due to not being used anymore.
OBSOLETE_HISTOGRAM[Autofill.BetterAuth.OptInPromoUserDecision.FromSettingsPage]=Removed due to not being used anymore.

Fixed: 345315233
Change-Id: I971a29df332de752e97ebf1ef2a513aa7160c494
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5601659
Commit-Queue: Vinny Persky <vinnypersky@google.com>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Olivia Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/main@{#1311577}
  • Loading branch information
Vinny Persky authored and pull[bot] committed Jun 14, 2024
1 parent 5015ec4 commit 1542719
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,9 @@ void LogUserVerifiabilityCheckDuration(const base::TimeDelta& duration) {
"Autofill.BetterAuth.UserVerifiabilityCheckDuration", duration);
}

void LogWebauthnOptChangeCalled(bool request_to_opt_in,
bool is_checkout_flow,
WebauthnOptInParameters metric) {
if (!request_to_opt_in) {
DCHECK(!is_checkout_flow);
return;
}

std::string histogram_name = "Autofill.BetterAuth.OptInCalled.";
histogram_name += is_checkout_flow ? "FromCheckoutFlow" : "FromSettingsPage";
base::UmaHistogramEnumeration(histogram_name, metric);
void LogWebauthnOptChangeCalled(WebauthnOptInParameters metric) {
base::UmaHistogramEnumeration(
"Autofill.BetterAuth.OptInCalled.FromCheckoutFlow", metric);
}

void LogWebauthnOptInPromoNotOfferedReason(
Expand All @@ -106,20 +98,15 @@ void LogWebauthnEnrollmentPromptOffered(bool offered) {
/*sample=*/offered);
}

void LogWebauthnOptInPromoShown(bool is_checkout_flow) {
std::string suffix =
is_checkout_flow ? "FromCheckoutFlow" : "FromSettingsPage";
base::UmaHistogramBoolean("Autofill.BetterAuth.OptInPromoShown." + suffix,
true);
void LogWebauthnOptInPromoShown() {
base::UmaHistogramBoolean(
"Autofill.BetterAuth.OptInPromoShown.FromCheckoutFlow", true);
}

void LogWebauthnOptInPromoUserDecision(
bool is_checkout_flow,
WebauthnOptInPromoUserDecisionMetric metric) {
std::string suffix =
(is_checkout_flow ? "FromCheckoutFlow" : "FromSettingsPage");
base::UmaHistogramEnumeration(
"Autofill.BetterAuth.OptInPromoUserDecision." + suffix, metric);
"Autofill.BetterAuth.OptInPromoUserDecision.FromCheckoutFlow", metric);
}

void LogWebauthnResult(WebauthnFlowEvent event, WebauthnResultMetric metric) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ void LogUserVerifiabilityCheckDuration(const base::TimeDelta& duration);

// Logs the count of calls to PaymentsNetworkInterface::OptChange() (aka
// UpdateAutofillUserPreference).
void LogWebauthnOptChangeCalled(bool request_to_opt_in,
bool is_checkout_flow,
WebauthnOptInParameters metric);
void LogWebauthnOptChangeCalled(WebauthnOptInParameters metric);

// Records when the Better Auth (FIDO) opt-in promo could have been offered on
// Desktop, but wasn't. Logged at the time of the promo not being shown. This
Expand All @@ -201,12 +199,11 @@ void LogWebauthnEnrollmentPromptOffered(bool offered);

// Logs the number of times the opt-in promo for enabling FIDO authentication
// for card unmasking has been shown.
void LogWebauthnOptInPromoShown(bool is_checkout_flow);
void LogWebauthnOptInPromoShown();

// Logs the user response to the opt-in promo for enabling FIDO authentication
// for card unmasking.
void LogWebauthnOptInPromoUserDecision(
bool is_checkout_flow,
WebauthnOptInPromoUserDecisionMetric metric);

// Logs the result of a WebAuthn prompt.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2642,45 +2642,6 @@ TEST_F(CreditCardAccessManagerTest,
autofill_metrics::WebauthnOptInParameters::kWithRequestChallenge, 1);
}

// Ensures WebAuthn result is logged correctly for a settings page opt-in.
TEST_F(CreditCardAccessManagerTest, SettingsPage_FIDOEnrollment) {
base::HistogramTester histogram_tester;
std::string opt_in_histogram_name =
"Autofill.BetterAuth.OptInCalled.FromSettingsPage";
std::string promo_shown_histogram_name =
"Autofill.BetterAuth.OptInPromoShown.FromSettingsPage";
std::string promo_user_decision_histogram_name =
"Autofill.BetterAuth.OptInPromoUserDecision.FromSettingsPage";

GetFIDOAuthenticator()->SetUserVerifiable(true);

for (bool did_succeed : {false, true}) {
SetCreditCardFIDOAuthEnabled(false);
credit_card_access_manager().OnSettingsPageFIDOAuthToggled(true);

// Mock user and payments response.
AcceptWebauthnOfferDialog(/*did_accept=*/true);
OptChange(AutofillClient::PaymentsRpcResult::kSuccess,
/*user_is_opted_in=*/false,
/*include_creation_options=*/true);
// Mock user response and payments response.
TestCreditCardFidoAuthenticator::MakeCredential(GetFIDOAuthenticator(),
did_succeed);
}

histogram_tester.ExpectTotalCount(opt_in_histogram_name, 3);
histogram_tester.ExpectBucketCount(
opt_in_histogram_name,
autofill_metrics::WebauthnOptInParameters::kFetchingChallenge, 2);
histogram_tester.ExpectBucketCount(
opt_in_histogram_name,
autofill_metrics::WebauthnOptInParameters::kWithCreationChallenge, 1);
histogram_tester.ExpectTotalCount(promo_shown_histogram_name, 2);
histogram_tester.ExpectUniqueSample(
promo_user_decision_histogram_name,
autofill_metrics::WebauthnOptInPromoUserDecisionMetric::kAccepted, 2);
}

TEST_F(CreditCardAccessManagerTest, SettingsPage_OptOut) {
base::HistogramTester histogram_tester;
GetFIDOAuthenticator()->SetUserVerifiable(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ void CreditCardFidoAuthenticator::OnWebauthnOfferDialogRequested(
// Cancel any previous pending WebAuthn requests.
authenticator()->Cancel();

autofill_metrics::LogWebauthnOptInPromoShown(
/*is_checkout_flow=*/!card_authorization_token_.empty());
autofill_metrics::LogWebauthnOptInPromoShown();

// At this point, it must be the case that the user is opted-out, otherwise
// there would be no need to register the user. However, if the user is
Expand All @@ -258,7 +257,6 @@ void CreditCardFidoAuthenticator::OnWebauthnOfferDialogUserResponse(
// If user declined, log user decision. User may have initially accepted the
// dialog, but then chose to cancel while the challenge was being fetched.
autofill_metrics::LogWebauthnOptInPromoUserDecision(
/*is_checkout_flow=*/!card_authorization_token_.empty(),
current_flow_ == OPT_IN_FETCH_CHALLENGE_FLOW
? autofill_metrics::WebauthnOptInPromoUserDecisionMetric::
kDeclinedAfterAccepting
Expand Down Expand Up @@ -324,7 +322,6 @@ void CreditCardFidoAuthenticator::GetAssertion(
// Now that the dialog has closed and will proceed to a WebAuthn prompt,
// the user must have accepted the dialog without cancelling.
autofill_metrics::LogWebauthnOptInPromoUserDecision(
/*is_checkout_flow=*/!card_authorization_token_.empty(),
autofill_metrics::WebauthnOptInPromoUserDecisionMetric::kAccepted);
} else {
current_flow_ = NONE_FLOW;
Expand All @@ -349,7 +346,6 @@ void CreditCardFidoAuthenticator::MakeCredential(
// Now that the dialog has closed and will proceed to a WebAuthn prompt,
// the user must have accepted the dialog without cancelling.
autofill_metrics::LogWebauthnOptInPromoUserDecision(
/*is_checkout_flow=*/!card_authorization_token_.empty(),
autofill_metrics::WebauthnOptInPromoUserDecisionMetric::kAccepted);
} else {
current_flow_ = NONE_FLOW;
Expand Down Expand Up @@ -396,7 +392,6 @@ void CreditCardFidoAuthenticator::OptChange(
// challenge, in which case |card_authorization_token_| will be required for
// the subsequent OptChange call.
autofill_metrics::WebauthnOptInParameters opt_change_metric;
bool is_checkout_flow = !card_authorization_token_.empty();
if (!authenticator_response.empty()) {
request_details.fido_authenticator_response =
std::move(authenticator_response);
Expand All @@ -420,9 +415,7 @@ void CreditCardFidoAuthenticator::OptChange(

// Logging call if user was attempting to change their opt-in state.
if (current_flow_ != FOLLOWUP_AFTER_CVC_AUTH_FLOW) {
bool request_to_opt_in = (current_flow_ != OPT_OUT_FLOW);
autofill_metrics::LogWebauthnOptChangeCalled(
request_to_opt_in, is_checkout_flow, opt_change_metric);
autofill_metrics::LogWebauthnOptChangeCalled(opt_change_metric);
}
}

Expand Down
32 changes: 8 additions & 24 deletions tools/metrics/histograms/metadata/autofill/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,6 @@ chromium-metrics-reviews@google.com.
summary="saved security code at the same time"/>
</variants>

<variants name="AutofillCreditCardWebauthnOptInOrigin">
<variant name=".FromCheckoutFlow" summary="Opt-in from a checkout flow"/>
<variant name=".FromSettingsPage" summary="Opt-in from settings page"/>
</variants>

<variants name="AutofillFidoAuthenticationEnabledState">
<variant name="OptedIn" summary="FIDO authentication enabled"/>
<variant name="OptedOut" summary="FIDO authentication disabled"/>
Expand Down Expand Up @@ -1034,21 +1029,17 @@ chromium-metrics-reviews@google.com.
</token>
</histogram>

<histogram
name="Autofill.BetterAuth.OptInCalled{AutofillCreditCardWebauthnOptInOrigin}"
<histogram name="Autofill.BetterAuth.OptInCalled.FromCheckoutFlow"
enum="AutofillCreditCardWebauthnOptInParameters" expires_after="2025-07-01">
<owner>jsaul@google.com</owner>
<owner>siyua@chromium.org</owner>
<owner>autofill-auth-team@google.com</owner>
<summary>
Tracks when users opt-in either from the settings page or from a checkout
flow, making an UpdateAutofillUserPreference call. For each call to
payments, logs if the call was made in order to verify an existing
credential, to create a new credential, or to fetch a challenge.
{AutofillCreditCardWebauthnOptInOrigin}
Tracks when users opt-in from a checkout flow, making an
UpdateAutofillUserPreference call. For each call to payments, logs if the
call was made in order to verify an existing credential, to create a new
credential, or to fetch a challenge.
</summary>
<token key="AutofillCreditCardWebauthnOptInOrigin"
variants="AutofillCreditCardWebauthnOptInOrigin"/>
</histogram>

<histogram name="Autofill.BetterAuth.OptInPromoNotOfferedReason"
Expand All @@ -1064,8 +1055,7 @@ chromium-metrics-reviews@google.com.
</summary>
</histogram>

<histogram
name="Autofill.BetterAuth.OptInPromoShown{AutofillCreditCardWebauthnOptInOrigin}"
<histogram name="Autofill.BetterAuth.OptInPromoShown.FromCheckoutFlow"
enum="BooleanHit" expires_after="2025-07-01">
<owner>jsaul@google.com</owner>
<owner>siyua@chromium.org</owner>
Expand All @@ -1081,14 +1071,10 @@ chromium-metrics-reviews@google.com.
Autofill.BetterAuth.UserPerceivedLatencyOnCardSelection.OptedOut), then the
promo should eventually show if the user selects a masked card and
successfully authenticates through CVC.
{AutofillCreditCardWebauthnOptInOrigin}
</summary>
<token key="AutofillCreditCardWebauthnOptInOrigin"
variants="AutofillCreditCardWebauthnOptInOrigin"/>
</histogram>

<histogram
name="Autofill.BetterAuth.OptInPromoUserDecision{AutofillCreditCardWebauthnOptInOrigin}"
<histogram name="Autofill.BetterAuth.OptInPromoUserDecision.FromCheckoutFlow"
enum="AutofillWebauthnOptInPromoUserDecision" expires_after="2025-07-01">
<owner>jsaul@google.com</owner>
<owner>siyua@chromium.org</owner>
Expand All @@ -1098,10 +1084,8 @@ chromium-metrics-reviews@google.com.
for card unmasking. The user can either accept the promo and proceed to
perform user-verification, can decline the promo immediately, or first
accept the promo but then decline while the challenge is being fetched. Only
applicable on Desktop. {AutofillCreditCardWebauthnOptInOrigin}
applicable on Desktop.
</summary>
<token key="AutofillCreditCardWebauthnOptInOrigin"
variants="AutofillCreditCardWebauthnOptInOrigin"/>
</histogram>

<histogram
Expand Down

0 comments on commit 1542719

Please sign in to comment.