Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: components/autofill/core/browser/autofill_metrics.cc

Issue 884843002: Recording in UMA when a user interacted with an address form or a credit card form. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing isherman comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/autofill_metrics.h" 5 #include "components/autofill/core/browser/autofill_metrics.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // static 458 // static
459 void AutofillMetrics::LogStoredProfileCount(size_t num_profiles) { 459 void AutofillMetrics::LogStoredProfileCount(size_t num_profiles) {
460 UMA_HISTOGRAM_COUNTS("Autofill.StoredProfileCount", num_profiles); 460 UMA_HISTOGRAM_COUNTS("Autofill.StoredProfileCount", num_profiles);
461 } 461 }
462 462
463 // static 463 // static
464 void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) { 464 void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) {
465 UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); 465 UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions);
466 } 466 }
467 467
468 AutofillMetrics::FormEventLogger::FormEventLogger(
469 bool is_credit_card,
470 bool is_server_data_available,
471 bool is_local_data_available)
472 : is_credit_card_(is_credit_card),
473 is_server_data_available_(is_server_data_available),
474 is_local_data_available_(is_local_data_available) {};
475
476 void AutofillMetrics::FormEventLogger::Log(AutofillFormEvent event) {
477 DCHECK_LT(event, NUM_AUTOFILL_FORM_EVENTS);
478 std::string custom_name("Autofill.FormEvents.");
Evan Stade 2015/01/30 19:39:49 ?
Walter Cacau 2015/01/30 22:05:56 ops old code from when I tried dynamically generat
479 if (is_credit_card_) {
480 UMA_HISTOGRAM_ENUMERATION("Autofill.FormEvents.CreditCard", event,
481 NUM_AUTOFILL_FORM_EVENTS);
482 } else {
483 UMA_HISTOGRAM_ENUMERATION("Autofill.FormEvents.Address", event,
484 NUM_AUTOFILL_FORM_EVENTS);
485 }
486
487 // Logging again in a different histogram for segmentation purposes.
488 if (!is_server_data_available_ && !is_local_data_available_) {
489 if (is_credit_card_) {
490 UMA_HISTOGRAM_ENUMERATION(
491 "Autofill.FormEvents.CreditCard.WithNoData",
Evan Stade 2015/01/30 19:39:50 this code could be a bit less verbose -- const ch
Walter Cacau 2015/01/30 22:05:56 So, I actually had code like that but the UMA macr
Evan Stade 2015/01/30 22:35:15 pretty sure you could still do this somehow with m
Ilya Sherman 2015/01/30 22:38:05 Alternately, you can inline the macro definition,
Walter Cacau 2015/01/31 00:35:55 Done.
492 event, NUM_AUTOFILL_FORM_EVENTS);
493 } else {
494 UMA_HISTOGRAM_ENUMERATION(
495 "Autofill.FormEvents.Address.WithNoData",
496 event, NUM_AUTOFILL_FORM_EVENTS);
497 }
498 } else if (is_server_data_available_ && !is_local_data_available_) {
499 if (is_credit_card_) {
500 UMA_HISTOGRAM_ENUMERATION(
501 "Autofill.FormEvents.CreditCard.WithOnlyServerData",
502 event, NUM_AUTOFILL_FORM_EVENTS);
503 } else {
504 UMA_HISTOGRAM_ENUMERATION(
505 "Autofill.FormEvents.Address.WithOnlyServerData",
506 event, NUM_AUTOFILL_FORM_EVENTS);
507 }
508 } else if (!is_server_data_available_ && is_local_data_available_) {
509 if (is_credit_card_) {
510 UMA_HISTOGRAM_ENUMERATION(
511 "Autofill.FormEvents.CreditCard.WithOnlyLocalData",
512 event, NUM_AUTOFILL_FORM_EVENTS);
513 } else {
514 UMA_HISTOGRAM_ENUMERATION(
515 "Autofill.FormEvents.Address.WithOnlyLocalData",
516 event, NUM_AUTOFILL_FORM_EVENTS);
517 }
518 } else {
519 if (is_credit_card_) {
520 UMA_HISTOGRAM_ENUMERATION(
521 "Autofill.FormEvents.CreditCard.WithBothServerAndLocalData",
522 event, NUM_AUTOFILL_FORM_EVENTS);
523 } else {
524 UMA_HISTOGRAM_ENUMERATION(
525 "Autofill.FormEvents.Address.WithBothServerAndLocalData",
526 event, NUM_AUTOFILL_FORM_EVENTS);
527 }
528 }
529 }
530
468 } // namespace autofill 531 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698