diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-31 02:31:20 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-31 02:31:20 +0000 |
commit | 6c716d35d3b6d486ca027d875f3f53b1d9e45a77 (patch) | |
tree | 284893c5bea8af402e060324ef12dcbbbe292af4 /chrome/browser/autofill/form_structure.cc | |
parent | a8b61c14b49ad7a083cf8aaf06988e16a745d3ad (diff) | |
download | chromium_src-6c716d35d3b6d486ca027d875f3f53b1d9e45a77.zip chromium_src-6c716d35d3b6d486ca027d875f3f53b1d9e45a77.tar.gz chromium_src-6c716d35d3b6d486ca027d875f3f53b1d9e45a77.tar.bz2 |
Add metrics for autofill heuristic, server, and overall field type prediction quality.
BUG=76945
TEST=unit_tests --gtest_filter=AutofillMetrics.*
Review URL: http://codereview.chromium.org/6708099
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/form_structure.cc')
-rw-r--r-- | chrome/browser/autofill/form_structure.cc | 121 |
1 files changed, 71 insertions, 50 deletions
diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc index d6c2577..bfe0d5d 100644 --- a/chrome/browser/autofill/form_structure.cc +++ b/chrome/browser/autofill/form_structure.cc @@ -332,64 +332,85 @@ void FormStructure::LogQualityMetrics( std::string experiment_id = cached_form.server_experiment_id(); for (size_t i = 0; i < field_count(); ++i) { const AutofillField* field = this->field(i); + metric_logger.Log(AutofillMetrics::FIELD_SUBMITTED, experiment_id); + + // No further logging for empty fields nor for fields where the entered data + // does not appear to already exist in the user's stored Autofill data. const FieldTypeSet& field_types = field->possible_types(); DCHECK(!field_types.empty()); - - if (field->form_control_type == ASCIIToUTF16("select-one")) { - // TODO(isherman): <select> fields don't support |is_autofilled|. Since - // this is heavily relied upon by our metrics, we just don't log anything - // for all <select> fields. Better to have less data than misleading data. + if (field_types.count(EMPTY_TYPE) || field_types.count(UNKNOWN_TYPE)) continue; + + AutofillFieldType heuristic_type = UNKNOWN_TYPE; + AutofillFieldType server_type = NO_SERVER_DATA; + AutofillFieldType combined_type = UNKNOWN_TYPE; + std::map<std::string, const AutofillField*>::const_iterator + cached_field = cached_fields.find(field->FieldSignature()); + if (cached_field != cached_fields.end()) { + heuristic_type = cached_field->second->heuristic_type(); + server_type = cached_field->second->server_type(); + combined_type = cached_field->second->type(); } - // Log various quality metrics. - metric_logger.Log(AutofillMetrics::FIELD_SUBMITTED, experiment_id); - if (field_types.find(EMPTY_TYPE) == field_types.end() && - field_types.find(UNKNOWN_TYPE) == field_types.end()) { - if (field->is_autofilled) { - metric_logger.Log(AutofillMetrics::FIELD_AUTOFILLED, experiment_id); - } else { - metric_logger.Log(AutofillMetrics::FIELD_AUTOFILL_FAILED, - experiment_id); + // Log heuristic, server, and overall type quality metrics, independently of + // whether the field was autofilled. + if (heuristic_type == UNKNOWN_TYPE) + metric_logger.Log(AutofillMetrics::HEURISTIC_TYPE_UNKNOWN); + else if (field_types.count(heuristic_type)) + metric_logger.Log(AutofillMetrics::HEURISTIC_TYPE_MATCH); + else + metric_logger.Log(AutofillMetrics::HEURISTIC_TYPE_MISMATCH); + + if (server_type == NO_SERVER_DATA) + metric_logger.Log(AutofillMetrics::SERVER_TYPE_UNKNOWN, experiment_id); + else if (field_types.count(server_type)) + metric_logger.Log(AutofillMetrics::SERVER_TYPE_MATCH, experiment_id); + else + metric_logger.Log(AutofillMetrics::SERVER_TYPE_MISMATCH, experiment_id); + + if (combined_type == UNKNOWN_TYPE) { + metric_logger.Log(AutofillMetrics::PREDICTED_TYPE_UNKNOWN, experiment_id); + } else if (field_types.count(combined_type)) { + metric_logger.Log(AutofillMetrics::PREDICTED_TYPE_MATCH, experiment_id); + } else { + metric_logger.Log(AutofillMetrics::PREDICTED_TYPE_MISMATCH, + experiment_id); + } - AutofillFieldType heuristic_type = UNKNOWN_TYPE; - AutofillFieldType server_type = NO_SERVER_DATA; - std::map<std::string, const AutofillField*>::const_iterator - cached_field = cached_fields.find(field->FieldSignature()); - if (cached_field != cached_fields.end()) { - heuristic_type = cached_field->second->heuristic_type(); - server_type = cached_field->second->server_type(); - } - - if (heuristic_type == UNKNOWN_TYPE) { - metric_logger.Log(AutofillMetrics::FIELD_HEURISTIC_TYPE_UNKNOWN, - experiment_id); - } else if (field_types.count(heuristic_type)) { - metric_logger.Log(AutofillMetrics::FIELD_HEURISTIC_TYPE_MATCH, - experiment_id); - } else { - metric_logger.Log(AutofillMetrics::FIELD_HEURISTIC_TYPE_MISMATCH, - experiment_id); - } - - if (server_type == NO_SERVER_DATA) { - metric_logger.Log(AutofillMetrics::FIELD_SERVER_TYPE_UNKNOWN, - experiment_id); - } else if (field_types.count(server_type)) { - metric_logger.Log(AutofillMetrics::FIELD_SERVER_TYPE_MATCH, - experiment_id); - } else { - metric_logger.Log(AutofillMetrics::FIELD_SERVER_TYPE_MISMATCH, - experiment_id); - } + // TODO(isherman): <select> fields don't support |is_autofilled()|, so we + // have to skip them for the remaining metrics. + if (field->form_control_type == ASCIIToUTF16("select-one")) + continue; + + if (field->is_autofilled) { + metric_logger.Log(AutofillMetrics::FIELD_AUTOFILLED, experiment_id); + } else { + metric_logger.Log(AutofillMetrics::FIELD_NOT_AUTOFILLED, + experiment_id); + + if (heuristic_type == UNKNOWN_TYPE) { + metric_logger.Log( + AutofillMetrics::NOT_AUTOFILLED_HEURISTIC_TYPE_UNKNOWN, + experiment_id); + } else if (field_types.count(heuristic_type)) { + metric_logger.Log(AutofillMetrics::NOT_AUTOFILLED_HEURISTIC_TYPE_MATCH, + experiment_id); + } else { + metric_logger.Log( + AutofillMetrics::NOT_AUTOFILLED_HEURISTIC_TYPE_MISMATCH, + experiment_id); } - // TODO(isherman): Other things we might want to log here: - // * Per Vadim's email, a combination of (1) whether heuristics fired, - // (2) whether the server returned something interesting, (3) whether - // the user filled the field - // * Whether the server type matches the heursitic type - // - Perhaps only if at least one of the types is not unknown/no data. + if (server_type == NO_SERVER_DATA) { + metric_logger.Log(AutofillMetrics::NOT_AUTOFILLED_SERVER_TYPE_UNKNOWN, + experiment_id); + } else if (field_types.count(server_type)) { + metric_logger.Log(AutofillMetrics::NOT_AUTOFILLED_SERVER_TYPE_MATCH, + experiment_id); + } else { + metric_logger.Log(AutofillMetrics::NOT_AUTOFILLED_SERVER_TYPE_MISMATCH, + experiment_id); + } } } } |