diff options
author | mlerman@chromium.org <mlerman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-02 01:23:49 +0000 |
---|---|---|
committer | mlerman@chromium.org <mlerman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-02 01:23:49 +0000 |
commit | c116a0625ddcccb633efb2d1c20d5f96c07520fc (patch) | |
tree | ba9ef383c5a6f7e11b69dc2c6f52b4f50b21a804 | |
parent | ba8b6ace0451acfac0dc814e89b22d3d72a0ac88 (diff) | |
download | chromium_src-c116a0625ddcccb633efb2d1c20d5f96c07520fc.zip chromium_src-c116a0625ddcccb633efb2d1c20d5f96c07520fc.tar.gz chromium_src-c116a0625ddcccb633efb2d1c20d5f96c07520fc.tar.bz2 |
UMA for New Profile Management. Track User-Menu Tutorial actions with Histograms.
Specifically tracking Tutorial Display, Tutorial Accept
and Tutorial Dismissal.
Googlers:
View the Enrollment section of the design doc for details.
https://docs.google.com/a/google.com/document/d/1ybiN1r2xAlMj0PBABH63PJIyVWhsM409xPpZI4zlmck
BUG=357693
TEST=Interact with the user menu and the tutorial card. Verify
that UMA Histograms reflect the actual behaviour.
Review URL: https://codereview.chromium.org/227083007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267716 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/profiles/profile_metrics.cc | 6 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_metrics.h | 21 | ||||
-rw-r--r-- | chrome/browser/ui/views/profiles/new_avatar_button.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/views/profiles/profile_chooser_view.cc | 21 | ||||
-rw-r--r-- | chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc | 102 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 1 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 17 |
7 files changed, 165 insertions, 5 deletions
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc index feb1922..a829be2 100644 --- a/chrome/browser/profiles/profile_metrics.cc +++ b/chrome/browser/profiles/profile_metrics.cc @@ -289,6 +289,12 @@ void ProfileMetrics::LogProfileAuthResult(ProfileAuth metric) { NUM_PROFILE_AUTH_METRICS); } +void ProfileMetrics::LogProfileUpgradeEnrollment( + ProfileUpgradeEnrollment metric) { + UMA_HISTOGRAM_ENUMERATION("Profile.UpgradeEnrollment", metric, + NUM_PROFILE_ENROLLMENT_METRICS); +} + void ProfileMetrics::LogProfileLaunch(Profile* profile) { base::FilePath profile_path = profile->GetPath(); UMA_HISTOGRAM_ENUMERATION("Profile.LaunchBrowser", diff --git a/chrome/browser/profiles/profile_metrics.h b/chrome/browser/profiles/profile_metrics.h index f31eb10..174c203 100644 --- a/chrome/browser/profiles/profile_metrics.h +++ b/chrome/browser/profiles/profile_metrics.h @@ -61,8 +61,8 @@ class ProfileMetrics { }; enum ProfileType { - ORIGINAL = 0, // Refers to the original/default profile - SECONDARY, // Refers to a user-created profile + ORIGINAL = 0, // Refers to the original/default profile + SECONDARY, // Refers to a user-created profile NUM_PROFILE_TYPE_METRICS }; @@ -80,6 +80,22 @@ class ProfileMetrics { NUM_PROFILE_AUTH_METRICS }; + // Enum for tracking if new profile management is enabled and Promo views. + // This is used in a histogram; the items should not be removed or re-ordered. + enum ProfileUpgradeEnrollment { + // User viewed the Upgrade promo card in the user menu. + PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO, + // User selected to view the intro tutorial. + PROFILE_ENROLLMENT_LAUNCH_LEARN_MORE, + // User opted into New Profile Management via Promo card. + PROFILE_ENROLLMENT_ACCEPT_NEW_PROFILE_MGMT, + // User closed the Upgrade card. + PROFILE_ENROLLMENT_CLOSE_WELCOME_CARD, + // Used disabled New Profile Management. + PROFILE_ENROLLMENT_DISABLE_NEW_PROFILE_MGMT, + NUM_PROFILE_ENROLLMENT_METRICS, + }; + static void UpdateReportedProfilesStatistics(ProfileManager* manager); static void LogNumberOfProfiles(ProfileManager* manager); @@ -91,6 +107,7 @@ class ProfileMetrics { static void LogProfileSwitchUser(ProfileOpen metric); static void LogProfileSyncInfo(ProfileSync metric); static void LogProfileAuthResult(ProfileAuth metric); + static void LogProfileUpgradeEnrollment(ProfileUpgradeEnrollment metric); // These functions should only be called on the UI thread because they hook // into g_browser_process through a helper function. diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.h b/chrome/browser/ui/views/profiles/new_avatar_button.h index 898b85f..3fad44f 100644 --- a/chrome/browser/ui/views/profiles/new_avatar_button.h +++ b/chrome/browser/ui/views/profiles/new_avatar_button.h @@ -31,7 +31,9 @@ class NewAvatarButton : public views::MenuButton, private: friend class NewAvatarMenuButtonTest; + friend class ProfileChooserViewBrowserTest; FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); + FRIEND_TEST_ALL_PREFIXES(ProfileChooserViewBrowserTest, ViewProfileUMA); // ProfileInfoCacheObserver: virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc index f580b87..e33d08c 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc @@ -11,6 +11,7 @@ #include "chrome/browser/profiles/profile_avatar_icon_util.h" #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" @@ -541,8 +542,13 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, // is indeed shown for the maximum number of times. browser_->profile()->GetPrefs()->SetInteger( prefs::kProfileAvatarTutorialShown, kProfileAvatarTutorialShowMax + 1); + + ProfileMetrics::LogProfileUpgradeEnrollment( + ProfileMetrics::PROFILE_ENROLLMENT_CLOSE_WELCOME_CARD); ShowView(BUBBLE_VIEW_MODE_PROFILE_CHOOSER, avatar_menu_.get()); } else if (sender == tutorial_enable_new_profile_management_button_) { + ProfileMetrics::LogProfileUpgradeEnrollment( + ProfileMetrics::PROFILE_ENROLLMENT_ACCEPT_NEW_PROFILE_MGMT); profiles::EnableNewProfileManagementPreview(); } else if (sender == remove_account_and_relaunch_button_) { RemoveAccount(); @@ -622,6 +628,8 @@ void ProfileChooserView::LinkClicked(views::Link* sender, int event_flags) { } else if (sender == add_account_link_) { ShowView(BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT, avatar_menu_.get()); } else if (sender == tutorial_learn_more_link_) { + ProfileMetrics::LogProfileUpgradeEnrollment( + ProfileMetrics::PROFILE_ENROLLMENT_LAUNCH_LEARN_MORE); // TODO(guohui): update |learn_more_url| once it is decided. const GURL lear_more_url("https://support.google.com/chrome/?hl=en#to"); chrome::NavigateParams params( @@ -691,10 +699,10 @@ views::View* ProfileChooserView::CreateProfileChooserView( current_profile_view = CreateCurrentProfileView(item, false); if (view_mode_ == BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { if (is_new_profile_management) { - tutorial_view = last_tutorial_mode == TUTORIAL_MODE_SEND_FEEDBACK ? + tutorial_view = tutorial_mode_ == TUTORIAL_MODE_SEND_FEEDBACK ? CreateSendPreviewFeedbackView() : CreatePreviewEnabledTutorialView( - item, last_tutorial_mode == TUTORIAL_MODE_PREVIEW_ENABLED); + item, tutorial_mode_ == TUTORIAL_MODE_PREVIEW_ENABLED); } else { tutorial_view = CreateNewProfileManagementPreviewView(); } @@ -707,6 +715,13 @@ views::View* ProfileChooserView::CreateProfileChooserView( } if (tutorial_view) { + // Be sure not to track the tutorial display on View refresh, and only count + // the preview-promo view, shown when New Profile Management is off. + if (tutorial_mode_ != last_tutorial_mode && + !switches::IsNewProfileManagement()) { + ProfileMetrics::LogProfileUpgradeEnrollment( + ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO); + } layout->StartRow(1, 0); layout->AddView(tutorial_view); } @@ -812,7 +827,7 @@ views::View* ProfileChooserView::CreateTutorialView( title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); title_label->SetAutoColorReadabilityEnabled(false); title_label->SetEnabledColor(SK_ColorWHITE); - title_label ->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( + title_label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( ui::ResourceBundle::MediumFont)); layout->StartRow(1, 0); layout->AddView(title_label); diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc new file mode 100644 index 0000000..af8fc1e --- /dev/null +++ b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc @@ -0,0 +1,102 @@ +// Copyright 2014 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 "chrome/browser/ui/views/profiles/profile_chooser_view.h" + +#include "base/command_line.h" +#include "base/path_service.h" +#include "base/prefs/pref_service.h" +#include "base/strings/utf_string_conversions.h" +#include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/profiles/profile_metrics.h" +#include "chrome/browser/profiles/profiles_state.h" +#include "chrome/browser/ui/browser_dialogs.h" +#include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/profiles/avatar_menu_button.h" +#include "chrome/browser/ui/views/profiles/new_avatar_button.h" +#include "chrome/browser/ui/views/profiles/user_manager_view.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/common/pref_names.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/test_switches.h" +#include "chrome/test/base/testing_browser_process.h" +#include "chrome/test/base/testing_profile_manager.h" +#include "chrome/test/base/uma_histogram_helper.h" +#include "components/signin/core/common/profile_management_switches.h" +#include "content/public/test/test_utils.h" +#include "grit/generated_resources.h" +#include "ui/views/controls/button/label_button.h" + +class ProfileChooserViewBrowserTest : public InProcessBrowserTest { + public: + ProfileChooserViewBrowserTest(); + virtual ~ProfileChooserViewBrowserTest(); + + protected: + virtual void SetUp() OVERRIDE; + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; + void OpenProfileChooserView(); + + private: + DISALLOW_COPY_AND_ASSIGN(ProfileChooserViewBrowserTest); +}; + +ProfileChooserViewBrowserTest::ProfileChooserViewBrowserTest() { +} + +ProfileChooserViewBrowserTest::~ProfileChooserViewBrowserTest() { +} + +void ProfileChooserViewBrowserTest::SetUp() { + InProcessBrowserTest::SetUp(); + DCHECK(CommandLine::ForCurrentProcess()->HasSwitch( + switches::kNewAvatarMenu)); +} + +void ProfileChooserViewBrowserTest::SetUpCommandLine( + CommandLine* command_line) { + command_line->AppendSwitch(switches::kNewAvatarMenu); +} + +void ProfileChooserViewBrowserTest::OpenProfileChooserView() { + BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); + NewAvatarButton* button = browser_view->frame()->GetNewAvatarMenuButton(); + ASSERT_TRUE(button); + + ProfileChooserView::clear_close_on_deactivate_for_testing(); + ui::MouseEvent mouse_ev(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0, + 0); + button->NotifyClick(mouse_ev); + base::MessageLoop::current()->RunUntilIdle(); + EXPECT_TRUE(ProfileChooserView::IsShowing()); +} + +#if defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_IOS) +// This test doesn't make sense for ChromeOS since it has a different +// multi-profiles menu in the system tray instead. +// +// Mobile platforms are also excluded due to a lack of avatar menu. +#define MAYBE_ViewProfileUMA DISABLED_ViewProfileUMA +#else +#define MAYBE_ViewProfileUMA ViewProfileUMA +#endif + +IN_PROC_BROWSER_TEST_F(ProfileChooserViewBrowserTest, MAYBE_ViewProfileUMA) { + UMAHistogramHelper histograms; + // If multiprofile mode is not enabled, you can't switch between profiles. + if (!profiles::IsMultipleProfilesEnabled()) + return; + + Profile* profile = browser()->profile(); + profile->GetPrefs()->SetInteger(prefs::kProfileAvatarTutorialShown, 0); + + ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView()); + + histograms.Fetch(); + histograms.ExpectUniqueSample("Profile.UpgradeEnrollment", + ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO, 1); +} diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 8fd2444..9367dfc 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1379,6 +1379,7 @@ 'browser/ui/views/location_bar/zoom_bubble_view_browsertest.cc', 'browser/ui/views/profiles/avatar_menu_button_browsertest.cc', 'browser/ui/views/profiles/new_avatar_menu_button_browsertest.cc', + 'browser/ui/views/profiles/profile_chooser_view_browsertest.cc', 'browser/ui/views/select_file_dialog_extension_browsertest.cc', 'browser/ui/views/toolbar/browser_actions_container_browsertest.cc', 'browser/ui/views/toolbar/toolbar_view_browsertest.cc', diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 60629b6..82dc47c 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -20611,6 +20611,15 @@ Therefore, the affected-histogram name has to have at least one dot in it. <summary>Times a profile name and/or avatar was updated.</summary> </histogram> +<histogram name="Profile.UpgradeEnrollment" enum="ProfileUpgradeEnrollment"> + <owner>mlerman@chromium.org</owner> + <summary> + The process which leads a user to enroll in New Profile Management. Also + tracks if the user chooses to opt out, and tutorials which guide the user + into New Profile Management. + </summary> +</histogram> + <histogram name="Profile.VisitedLinksSize" units="MB"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <summary>Size of the visited links database.</summary> @@ -39648,6 +39657,14 @@ Therefore, the affected-histogram name has to have at least one dot in it. <int value="1" label="Secondary (user-created) profile"/> </enum> +<enum name="ProfileUpgradeEnrollment" type="int"> + <int value="0" label="User viewed the Upgrade promo card in the user menu."/> + <int value="1" label="User selected to view the intro tutorial."/> + <int value="2" label="User opted into New Profile Management by Promo card."/> + <int value="3" label="User closed the Upgrade card."/> + <int value="4" label="Used disabled New Profiles Management."/> +</enum> + <enum name="ProtectorError" type="int"> <obsolete> Deprecated 8/2013. No longer generated. |