Commit a5063ee3 authored by Meilin Wang's avatar Meilin Wang Committed by Chromium LUCI CQ

[CrOS PhoneHub] Add metrics for opt-in entrypoint.

Bug:1150634

Change-Id: Ia9ac840f9d8eccf75ddb40d2dd55007e2e4a53ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2556444Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Meilin Wang <meilinw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832137}
parent d07e925c
......@@ -16,6 +16,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chromeos/multidevice_setup/multidevice_setup_dialog.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/phonehub/util/histogram_util.h"
#include "chromeos/components/proximity_auth/proximity_auth_pref_names.h"
#include "chromeos/constants/chromeos_features.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
......@@ -273,6 +274,11 @@ void MultideviceHandler::HandleSetFeatureEnabledState(
feature, enabled, auth_token,
base::BindOnce(&MultideviceHandler::OnSetFeatureStateEnabledResult,
callback_weak_ptr_factory_.GetWeakPtr(), callback_id));
if (feature == multidevice_setup::mojom::Feature::kPhoneHub) {
phonehub::util::LogFeatureOptInEntryPoint(
phonehub::util::OptInEntryPoint::kSettings);
}
}
void MultideviceHandler::HandleRemoveHostDevice(const base::ListValue* args) {
......
......@@ -80,6 +80,8 @@ static_library("phonehub") {
"tether_controller.h",
"tether_controller_impl.cc",
"tether_controller_impl.h",
"util/histogram_util.cc",
"util/histogram_util.h",
]
deps = [
......
......@@ -6,6 +6,7 @@
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/components/phonehub/pref_names.h"
#include "chromeos/components/phonehub/util/histogram_util.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
......@@ -68,6 +69,7 @@ void MultideviceSetupStateUpdater::OnHostStatusChanged(
multidevice_setup_client_->SetFeatureEnabledState(
Feature::kPhoneHub, /*enabled=*/true, /*auth_token=*/base::nullopt,
base::DoNothing());
util::LogFeatureOptInEntryPoint(util::OptInEntryPoint::kSetupFlow);
}
UpdateIsAwaitingVerifiedHost(host_status);
......
......@@ -3,8 +3,10 @@
// found in the LICENSE file.
#include "chromeos/components/phonehub/onboarding_ui_tracker_impl.h"
#include "chromeos/components/phonehub/feature_status.h"
#include "chromeos/components/phonehub/pref_names.h"
#include "chromeos/components/phonehub/util/histogram_util.h"
#include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
......@@ -60,6 +62,7 @@ void OnboardingUiTrackerImpl::HandleGetStarted() {
multidevice_setup_client_->SetFeatureEnabledState(
multidevice_setup::mojom::Feature::kPhoneHub,
/*enabled=*/true, /*auth_token=*/base::nullopt, base::DoNothing());
util::LogFeatureOptInEntryPoint(util::OptInEntryPoint::kOnboardingFlow);
return;
}
LOG(ERROR)
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/components/phonehub/util/histogram_util.h"
#include "base/metrics/histogram_macros.h"
namespace chromeos {
namespace phonehub {
namespace util {
void LogFeatureOptInEntryPoint(OptInEntryPoint entry_point) {
UMA_HISTOGRAM_ENUMERATION("PhoneHub.OptInEntryPoint", entry_point);
}
} // namespace util
} // namespace phonehub
} // namespace chromeos
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_COMPONENTS_PHONEHUB_UTIL_HISTOGRAM_UTIL_H_
#define CHROMEOS_COMPONENTS_PHONEHUB_UTIL_HISTOGRAM_UTIL_H_
namespace chromeos {
namespace phonehub {
namespace util {
// Enumeration of possible opt-in entry points for Phone Hub feature. Keep in
// sync with corresponding enum in tools/metrics/histograms/enums.xml. These
// values are persisted to logs. Entries should not be renumbered and numeric
// values should never be reused.
enum class OptInEntryPoint {
kSetupFlow = 0,
kOnboardingFlow = 1,
kSettings = 2,
kMaxValue = kSettings,
};
// Logs a given opt-in |entry_point| for the PhoneHub feature.
void LogFeatureOptInEntryPoint(OptInEntryPoint entry_point);
} // namespace util
} // namespace phonehub
} // namespace chromeos
#endif // CHROMEOS_COMPONENTS_PHONEHUB_UTIL_HISTOGRAM_UTIL_H_
......@@ -58078,6 +58078,12 @@ Called by update_net_trust_anchors.py.-->
<int value="1" label="User dismissed notification"/>
</enum>
<enum name="PhoneHubOptInEntryPoint">
<int value="0" label="New user opted in via multidevice setup flow"/>
<int value="1" label="User opted in via onboarding promotion"/>
<int value="2" label="User opted in via Settings page"/>
</enum>
<enum name="PhoneHubQuickAction">
<int value="0" label="Toggle Hotspot On"/>
<int value="1" label="Toggle Hotspot Off"/>
......@@ -122,6 +122,13 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<summary>Events for the given notification opt-in prompt.</summary>
</histogram>
<histogram name="PhoneHub.OptInEntryPoint" enum="PhoneHubOptInEntryPoint"
expires_after="2021-11-25">
<owner>meilinw@chromium.org</owner>
<owner>khorimoto@chromium.org</owner>
<summary>Tracks the UI surface with which users enable Phone Hub.</summary>
</histogram>
<histogram name="PhoneHub.QuickActionClicked" enum="PhoneHubQuickAction"
expires_after="2021-10-31">
<owner>tengs@chromium.org</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