diff options
author | sreeram@chromium.org <sreeram@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 23:32:16 +0000 |
---|---|---|
committer | sreeram@chromium.org <sreeram@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-21 23:32:16 +0000 |
commit | 9ed597ba1ed53df297d65c04d76f009bf98cb7f1 (patch) | |
tree | 49e44c8865d34bf00b868e1d3798c48b90808967 /chrome | |
parent | 5e212edaf84b2695da04a8d6d7cb701e85ca9e2e (diff) | |
download | chromium_src-9ed597ba1ed53df297d65c04d76f009bf98cb7f1.zip chromium_src-9ed597ba1ed53df297d65c04d76f009bf98cb7f1.tar.gz chromium_src-9ed597ba1ed53df297d65c04d76f009bf98cb7f1.tar.bz2 |
Simplify Instant field trials.
Simplifies the field trials by removing the unnecessary a/b split. Also:
+ Updates 'ix' param codes and group percentages.
+ Removes UMA restriction, but this is a no-op at the moment, since it's
handled on the server side.
BUG=none
TEST=none (no change in functionality or UI).
Review URL: http://codereview.chromium.org/9797003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128098 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/instant/instant_field_trial.cc | 182 | ||||
-rw-r--r-- | chrome/browser/instant/instant_field_trial.h | 73 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 10 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 |
4 files changed, 85 insertions, 181 deletions
diff --git a/chrome/browser/instant/instant_field_trial.cc b/chrome/browser/instant/instant_field_trial.cc index 48a562e..dee598f 100644 --- a/chrome/browser/instant/instant_field_trial.cc +++ b/chrome/browser/instant/instant_field_trial.cc @@ -17,52 +17,28 @@ namespace { // Field trial IDs of the control and experiment groups. Though they are not // literally "const", they are set only once, in Activate() below. See the .h // file for what these groups represent. -int g_instant_experiment_a = 0; -int g_instant_experiment_b = 0; - -int g_hidden_experiment_a = 0; -int g_hidden_experiment_b = 0; - -int g_silent_experiment_a = 0; -int g_silent_experiment_b = 0; - -int g_suggest_experiment_a = 0; -int g_suggest_experiment_b = 0; - -int g_uma_control_a = 0; -int g_uma_control_b = 0; - -int g_all_control_a = 0; -int g_all_control_b = 0; +int g_instant = 0; +int g_suggest = 0; +int g_hidden = 0; +int g_silent = 0; +int g_control = 0; } // static void InstantFieldTrial::Activate() { scoped_refptr<base::FieldTrial> trial( - new base::FieldTrial("Instant", 1000, "Inactive", 2012, 7, 1)); + new base::FieldTrial("Instant", 1000, "Inactive", 2013, 7, 1)); // Try to give the user a consistent experience, if possible. if (base::FieldTrialList::IsOneTimeRandomizationEnabled()) trial->UseOneTimeRandomization(); - g_instant_experiment_a = trial->AppendGroup("InstantExperimentA", 50); - g_instant_experiment_b = trial->AppendGroup("InstantExperimentB", 50); - - g_hidden_experiment_a = trial->AppendGroup("HiddenExperimentA", 50); - g_hidden_experiment_b = trial->AppendGroup("HiddenExperimentB", 50); - - g_silent_experiment_a = trial->AppendGroup("SilentExperimentA", 50); - g_silent_experiment_b = trial->AppendGroup("SilentExperimentB", 50); - - g_suggest_experiment_a = trial->AppendGroup("SuggestExperimentA", 50); - g_suggest_experiment_b = trial->AppendGroup("SuggestExperimentB", 50); - - g_uma_control_a = trial->AppendGroup("UmaControlA", 50); - g_uma_control_b = trial->AppendGroup("UmaControlB", 50); - - g_all_control_a = trial->AppendGroup("AllControlA", 50); - g_all_control_b = trial->AppendGroup("AllControlB", 50); + g_instant = trial->AppendGroup("Instant", 10); // 1% + g_suggest = trial->AppendGroup("Suggest", 10); // 1% + g_hidden = trial->AppendGroup("Hidden", 960); // 96% + g_silent = trial->AppendGroup("Silent", 10); // 1% + g_control = trial->AppendGroup("Control", 10); // 1% } // static @@ -72,15 +48,16 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) { std::string switch_value = command_line->GetSwitchValueASCII(switches::kInstantFieldTrial); if (switch_value == switches::kInstantFieldTrialInstant) - return INSTANT_EXPERIMENT_A; - else if (switch_value == switches::kInstantFieldTrialHidden) - return HIDDEN_EXPERIMENT_A; - else if (switch_value == switches::kInstantFieldTrialSilent) - return SILENT_EXPERIMENT_A; - else if (switch_value == switches::kInstantFieldTrialSuggest) - return SUGGEST_EXPERIMENT_A; - else - return INACTIVE; + return INSTANT; + if (switch_value == switches::kInstantFieldTrialSuggest) + return SUGGEST; + if (switch_value == switches::kInstantFieldTrialHidden) + return HIDDEN; + if (switch_value == switches::kInstantFieldTrialSilent) + return SILENT; + if (switch_value == switches::kInstantFieldTrialControl) + return CONTROL; + return INACTIVE; } const int group = base::FieldTrialList::FindValue("Instant"); @@ -90,49 +67,23 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) { } const PrefService* prefs = profile ? profile->GetPrefs() : NULL; - if (!prefs || + if (!prefs || profile->IsOffTheRecord() || prefs->GetBoolean(prefs::kInstantEnabledOnce) || + !prefs->GetBoolean(prefs::kSearchSuggestEnabled) || prefs->IsManagedPreference(prefs::kInstantEnabled)) { return INACTIVE; } - // First, deal with the groups that don't require UMA opt-in. - if (group == g_silent_experiment_a) - return SILENT_EXPERIMENT_A; - if (group == g_silent_experiment_b) - return SILENT_EXPERIMENT_B; - - if (group == g_all_control_a) - return ALL_CONTROL_A; - if (group == g_all_control_b) - return ALL_CONTROL_B; - - // All other groups require UMA and suggest, else bounce back to INACTIVE. - if (profile->IsOffTheRecord() || - !MetricsServiceHelper::IsMetricsReportingEnabled() || - !prefs->GetBoolean(prefs::kSearchSuggestEnabled)) { - return INACTIVE; - } - - if (group == g_instant_experiment_a) - return INSTANT_EXPERIMENT_A; - if (group == g_instant_experiment_b) - return INSTANT_EXPERIMENT_B; - - if (group == g_hidden_experiment_a) - return HIDDEN_EXPERIMENT_A; - if (group == g_hidden_experiment_b) - return HIDDEN_EXPERIMENT_B; - - if (group == g_suggest_experiment_a) - return SUGGEST_EXPERIMENT_A; - if (group == g_suggest_experiment_b) - return SUGGEST_EXPERIMENT_B; - - if (group == g_uma_control_a) - return UMA_CONTROL_A; - if (group == g_uma_control_b) - return UMA_CONTROL_B; + if (group == g_instant) + return INSTANT; + if (group == g_suggest) + return SUGGEST; + if (group == g_hidden) + return HIDDEN; + if (group == g_silent) + return SILENT; + if (group == g_control) + return CONTROL; NOTREACHED(); return INACTIVE; @@ -141,48 +92,31 @@ InstantFieldTrial::Group InstantFieldTrial::GetGroup(Profile* profile) { // static bool InstantFieldTrial::IsInstantExperiment(Profile* profile) { Group group = GetGroup(profile); - return group == INSTANT_EXPERIMENT_A || group == INSTANT_EXPERIMENT_B || - group == HIDDEN_EXPERIMENT_A || group == HIDDEN_EXPERIMENT_B || - group == SILENT_EXPERIMENT_A || group == SILENT_EXPERIMENT_B || - group == SUGGEST_EXPERIMENT_A || group == SUGGEST_EXPERIMENT_B; + return group == INSTANT || group == SUGGEST || group == HIDDEN || + group == SILENT; } // static bool InstantFieldTrial::IsHiddenExperiment(Profile* profile) { Group group = GetGroup(profile); - return group == HIDDEN_EXPERIMENT_A || group == HIDDEN_EXPERIMENT_B || - group == SILENT_EXPERIMENT_A || group == SILENT_EXPERIMENT_B || - group == SUGGEST_EXPERIMENT_A || group == SUGGEST_EXPERIMENT_B; + return group == SUGGEST || group == HIDDEN || group == SILENT; } // static bool InstantFieldTrial::IsSilentExperiment(Profile* profile) { Group group = GetGroup(profile); - return group == SILENT_EXPERIMENT_A || group == SILENT_EXPERIMENT_B; + return group == SILENT; } // static std::string InstantFieldTrial::GetGroupName(Profile* profile) { switch (GetGroup(profile)) { case INACTIVE: return std::string(); - - case INSTANT_EXPERIMENT_A: return "_InstantExperimentA"; - case INSTANT_EXPERIMENT_B: return "_InstantExperimentB"; - - case HIDDEN_EXPERIMENT_A: return "_HiddenExperimentA"; - case HIDDEN_EXPERIMENT_B: return "_HiddenExperimentB"; - - case SILENT_EXPERIMENT_A: return "_SilentExperimentA"; - case SILENT_EXPERIMENT_B: return "_SilentExperimentB"; - - case SUGGEST_EXPERIMENT_A: return "_SuggestExperimentA"; - case SUGGEST_EXPERIMENT_B: return "_SuggestExperimentB"; - - case UMA_CONTROL_A: return "_UmaControlA"; - case UMA_CONTROL_B: return "_UmaControlB"; - - case ALL_CONTROL_A: return "_AllControlA"; - case ALL_CONTROL_B: return "_AllControlB"; + case INSTANT: return "_Instant"; + case SUGGEST: return "_Suggest"; + case HIDDEN: return "_Hidden"; + case SILENT: return "_Silent"; + case CONTROL: return "_Control"; } NOTREACHED(); @@ -191,26 +125,19 @@ std::string InstantFieldTrial::GetGroupName(Profile* profile) { // static std::string InstantFieldTrial::GetGroupAsUrlParam(Profile* profile) { + bool uma = MetricsServiceHelper::IsMetricsReportingEnabled(); switch (GetGroup(profile)) { case INACTIVE: return std::string(); - - case INSTANT_EXPERIMENT_A: return "ix=iea&"; - case INSTANT_EXPERIMENT_B: return "ix=ieb&"; - - case HIDDEN_EXPERIMENT_A: return "ix=hea&"; - case HIDDEN_EXPERIMENT_B: return "ix=heb&"; - - case SILENT_EXPERIMENT_A: return "ix=sea&"; - case SILENT_EXPERIMENT_B: return "ix=seb&"; - - case SUGGEST_EXPERIMENT_A: return "ix=tea&"; - case SUGGEST_EXPERIMENT_B: return "ix=teb&"; - - case UMA_CONTROL_A: return "ix=uca&"; - case UMA_CONTROL_B: return "ix=ucb&"; - - case ALL_CONTROL_A: return "ix=aca&"; - case ALL_CONTROL_B: return "ix=acb&"; + case INSTANT: if (uma) return "ix=ui&"; + return "ix=ni&"; + case SUGGEST: if (uma) return "ix=ut&"; + return "ix=nt&"; + case HIDDEN: if (uma) return "ix=uh&"; + return "ix=nh&"; + case SILENT: if (uma) return "ix=us&"; + return "ix=ns&"; + case CONTROL: if (uma) return "ix=uc&"; + return "ix=nc&"; } NOTREACHED(); @@ -220,6 +147,5 @@ std::string InstantFieldTrial::GetGroupAsUrlParam(Profile* profile) { // static bool InstantFieldTrial::ShouldSetSuggestedText(Profile* profile) { Group group = GetGroup(profile); - return !(group == HIDDEN_EXPERIMENT_A || group == HIDDEN_EXPERIMENT_B || - group == SILENT_EXPERIMENT_A || group == SILENT_EXPERIMENT_B); + return group != HIDDEN && group != SILENT; } diff --git a/chrome/browser/instant/instant_field_trial.h b/chrome/browser/instant/instant_field_trial.h index 5e2b3f8..a6f390d 100644 --- a/chrome/browser/instant/instant_field_trial.h +++ b/chrome/browser/instant/instant_field_trial.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -19,57 +19,32 @@ class Profile; // Instant preference is respected. Incognito profiles are also INACTIVE. // // The following mutually exclusive groups each select a small random sample of -// the remaining users. Instant is enabled with preloading for the EXPERIMENT -// groups. It remains disabled, as is default, for the CONTROL groups. +// the remaining users. Instant is enabled with preloading of the search engine +// homepage for all the experiment groups. It remains disabled, as is default, +// for the CONTROL group. // -// INSTANT_EXPERIMENT: Queries are issued as the user types, and previews are -// shown. If the user hasn't opted to send metrics (UMA) data, they are -// bounced back to INACTIVE. +// INSTANT: Queries are issued as the user types. Predicted query is inline +// autocompleted into the omnibox. Result previews are shown. // -// HIDDEN_EXPERIMENT: Queries are issued as the user types, but no preview is -// shown until they press <Enter>. If the user hasn't opted to send metrics -// (UMA) data, they are bounced back to INACTIVE. Suggestions obtained from -// Instant are not propagated back to the omnibox. +// SUGGEST: Same as INSTANT, without the previews. // -// SILENT_EXPERIMENT: No queries are issued until the user presses <Enter>. No -// previews are shown. The user is not required to send metrics (UMA) data. +// HIDDEN: Same as SUGGEST, without the inline autocompletion. // -// SUGGEST_EXPERIMENT: Same as HIDDEN, except that the Instant suggestions are -// autocompleted inline into the omnibox. +// SILENT: Same as HIDDEN, without issuing queries as the user types. The query +// is sent only after the user presses <Enter>. // -// UMA_CONTROL: Instant is disabled. If the user hasn't opted to send metrics -// (UMA) data, they are bounced back to INACTIVE. -// -// ALL_CONTROL: Instant is disabled. The user is not required to send metrics -// (UMA) data. +// CONTROL: Instant is disabled. // // Users not chosen into any of the above groups are INACTIVE. -// -// Each non-INACTIVE group is split into two equal subgroups, to detect bias -// between them when analyzing metrics. The subgroups are denoted by "_A" and -// "_B" suffixes, and are treated identically for all other purposes. class InstantFieldTrial { public: enum Group { INACTIVE, - - INSTANT_EXPERIMENT_A, - INSTANT_EXPERIMENT_B, - - HIDDEN_EXPERIMENT_A, - HIDDEN_EXPERIMENT_B, - - SILENT_EXPERIMENT_A, - SILENT_EXPERIMENT_B, - - SUGGEST_EXPERIMENT_A, - SUGGEST_EXPERIMENT_B, - - UMA_CONTROL_A, - UMA_CONTROL_B, - - ALL_CONTROL_A, - ALL_CONTROL_B, + INSTANT, + SUGGEST, + HIDDEN, + SILENT, + CONTROL }; // Activate the field trial. Before this call, all calls to GetGroup will @@ -79,25 +54,25 @@ class InstantFieldTrial { // Return the field trial group this profile belongs to. static Group GetGroup(Profile* profile); - // Check if the user is in any of the EXPERIMENT groups. + // Check if the user is in any of the experiment groups. static bool IsInstantExperiment(Profile* profile); - // Check if the user is in the HIDDEN, SILENT or SUGGEST EXPERIMENT groups. + // Check if the user is in the SUGGEST, HIDDEN or SILENT groups. static bool IsHiddenExperiment(Profile* profile); - // Check if the user is in the SILENT EXPERIMENT group. + // Check if the user is in the SILENT group. static bool IsSilentExperiment(Profile* profile); // Returns a string describing the user's group. Can be added to histogram // names, to split histograms by field trial groups. static std::string GetGroupName(Profile* profile); - // Returns a string denoting the user's group, for adding as a URL param. - static std::string GetGroupAsUrlParam(Profile* profile); + // Returns a string denoting the user's group, for adding as a URL param. + static std::string GetGroupAsUrlParam(Profile* profile); - // Returns whether the Instant suggested text should be autocompleted inline - // into the omnibox. - static bool ShouldSetSuggestedText(Profile* profile); + // Returns whether the Instant suggested text should be autocompleted inline + // into the omnibox. + static bool ShouldSetSuggestedText(Profile* profile); private: DISALLOW_IMPLICIT_CONSTRUCTORS(InstantFieldTrial); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 3cd7ec4..0ad9771 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -747,13 +747,15 @@ const char kIncognito[] = "incognito"; // Controls the Instant field trial. Valid values are defined below. If an // unknown value is supplied on the command line, the field trial is disabled. const char kInstantFieldTrial[] = "instant-field-trial"; -// The field trial is forced into the HIDDEN_EXPERIMENT group. +// The field trial is forced into the CONTROL group. +const char kInstantFieldTrialControl[] = "control"; +// The field trial is forced into the HIDDEN group. const char kInstantFieldTrialHidden[] = "hidden"; -// The field trial is forced into the INSTANT_EXPERIMENT group. +// The field trial is forced into the INSTANT group. const char kInstantFieldTrialInstant[] = "instant"; -// The field trial is forced into the SILENT_EXPERIMENT group. +// The field trial is forced into the SILENT group. const char kInstantFieldTrialSilent[] = "silent"; -// The field trial is forced into the SUGGEST_EXPERIMENT group. +// The field trial is forced into the SUGGEST group. const char kInstantFieldTrialSuggest[] = "suggest"; // URL to use for instant. If specified this overrides the url from the diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 8d81db9..8bd0e001f 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -202,6 +202,7 @@ extern const char kImport[]; extern const char kImportFromFile[]; extern const char kIncognito[]; extern const char kInstantFieldTrial[]; +extern const char kInstantFieldTrialControl[]; extern const char kInstantFieldTrialHidden[]; extern const char kInstantFieldTrialInstant[]; extern const char kInstantFieldTrialSilent[]; |