| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ntp_snippets/content_suggestions_metrics.h" | 5 #include "components/ntp_snippets/content_suggestions_metrics.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <type_traits> | 9 #include <type_traits> |
| 10 | 10 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 kHistogramOpenDisposition, static_cast<int>(disposition), | 285 kHistogramOpenDisposition, static_cast<int>(disposition), |
| 286 static_cast<int>(WindowOpenDisposition::MAX_VALUE) + 1); | 286 static_cast<int>(WindowOpenDisposition::MAX_VALUE) + 1); |
| 287 base::UmaHistogramExactLinear( | 287 base::UmaHistogramExactLinear( |
| 288 GetCategoryHistogramName(kHistogramOpenDisposition, category), | 288 GetCategoryHistogramName(kHistogramOpenDisposition, category), |
| 289 static_cast<int>(disposition), | 289 static_cast<int>(disposition), |
| 290 static_cast<int>(WindowOpenDisposition::MAX_VALUE) + 1); | 290 static_cast<int>(WindowOpenDisposition::MAX_VALUE) + 1); |
| 291 | 291 |
| 292 if (category.IsKnownCategory(KnownCategories::ARTICLES)) { | 292 if (category.IsKnownCategory(KnownCategories::ARTICLES)) { |
| 293 RecordContentSuggestionsUsage(); | 293 RecordContentSuggestionsUsage(); |
| 294 } | 294 } |
| 295 |
| 296 base::RecordAction(base::UserMetricsAction("Suggestions.Content.Opened")); |
| 295 } | 297 } |
| 296 | 298 |
| 297 void OnSuggestionMenuOpened(int global_position, | 299 void OnSuggestionMenuOpened(int global_position, |
| 298 Category category, | 300 Category category, |
| 299 int position_in_category, | 301 int position_in_category, |
| 300 base::Time publish_date, | 302 base::Time publish_date, |
| 301 float score) { | 303 float score) { |
| 302 UMA_HISTOGRAM_EXACT_LINEAR(kHistogramMenuOpened, global_position, | 304 UMA_HISTOGRAM_EXACT_LINEAR(kHistogramMenuOpened, global_position, |
| 303 kMaxSuggestionsTotal); | 305 kMaxSuggestionsTotal); |
| 304 LogCategoryHistogramPosition(kHistogramMenuOpened, category, | 306 LogCategoryHistogramPosition(kHistogramMenuOpened, category, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 UMA_HISTOGRAM_ENUMERATION(kHistogramCategoryDismissed, | 361 UMA_HISTOGRAM_ENUMERATION(kHistogramCategoryDismissed, |
| 360 GetHistogramCategory(category), | 362 GetHistogramCategory(category), |
| 361 HistogramCategories::COUNT); | 363 HistogramCategories::COUNT); |
| 362 } | 364 } |
| 363 | 365 |
| 364 void RecordRemoteSuggestionsProviderState(bool enabled) { | 366 void RecordRemoteSuggestionsProviderState(bool enabled) { |
| 365 UMA_HISTOGRAM_BOOLEAN( | 367 UMA_HISTOGRAM_BOOLEAN( |
| 366 "NewTabPage.ContentSuggestions.Preferences.RemoteSuggestions", enabled); | 368 "NewTabPage.ContentSuggestions.Preferences.RemoteSuggestions", enabled); |
| 367 } | 369 } |
| 368 | 370 |
| 371 void RecordContentSuggestionDismissed() { |
| 372 base::RecordAction(base::UserMetricsAction("Suggestions.Content.Dismissed")); |
| 373 } |
| 374 |
| 375 void RecordCategoryDismissed() { |
| 376 base::RecordAction(base::UserMetricsAction("Suggestions.Category.Dismissed")); |
| 377 } |
| 378 |
| 379 void RecordFetchAction() { |
| 380 base::RecordAction(base::UserMetricsAction("Suggestions.Category.Fetch")); |
| 381 } |
| 382 |
| 369 } // namespace metrics | 383 } // namespace metrics |
| 370 } // namespace ntp_snippets | 384 } // namespace ntp_snippets |
| OLD | NEW |