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

Unified Diff: chrome/browser/android/most_visited_sites.cc

Issue 701353004: [Most Visited] Only log impression metrics on initial NTP load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/most_visited_sites.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/most_visited_sites.cc
diff --git a/chrome/browser/android/most_visited_sites.cc b/chrome/browser/android/most_visited_sites.cc
index 244b8790d14637c646e3da9db53c2f46971a8b18..e40ffab014cee6f5daf185392bdb7a21d402666c 100644
--- a/chrome/browser/android/most_visited_sites.cc
+++ b/chrome/browser/android/most_visited_sites.cc
@@ -191,8 +191,8 @@ SyncState GetSyncState(Profile* profile) {
MostVisitedSites::MostVisitedSites(Profile* profile)
: profile_(profile), num_sites_(0), is_control_group_(false),
- num_local_thumbs_(0), num_server_thumbs_(0), num_empty_thumbs_(0),
- weak_ptr_factory_(this) {
+ initial_load_done_(false), num_local_thumbs_(0), num_server_thumbs_(0),
+ num_empty_thumbs_(0), weak_ptr_factory_(this) {
// Register the debugging page for the Suggestions Service and the thumbnails
// debugging page.
content::URLDataSource::Add(profile_,
@@ -399,13 +399,17 @@ void MostVisitedSites::OnMostVisitedURLsAvailable(
mv_source_ = TOP_SITES;
- int num_tiles = urls.size();
- UMA_HISTOGRAM_SPARSE_SLOWLY(kNumTilesHistogramName, num_tiles);
- const std::string histogram = is_control_group_ ?
- kImpressionControlHistogramName : kImpressionClientHistogramName;
- for (int i = 0; i < num_tiles; ++i) {
- LogHistogramEvent(histogram, i, num_sites_);
+ // Only log impression metrics on the initial load of the NTP.
+ if (!initial_load_done_) {
+ int num_tiles = urls.size();
+ UMA_HISTOGRAM_SPARSE_SLOWLY(kNumTilesHistogramName, num_tiles);
+ const std::string histogram = is_control_group_ ?
+ kImpressionControlHistogramName : kImpressionClientHistogramName;
+ for (int i = 0; i < num_tiles; ++i) {
+ LogHistogramEvent(histogram, i, num_sites_);
+ }
}
+ initial_load_done_ = true;
JNIEnv* env = AttachCurrentThread();
Java_MostVisitedURLsObserver_onMostVisitedURLsAvailable(
@@ -439,15 +443,21 @@ void MostVisitedSites::OnSuggestionsProfileAvailable(
const ChromeSuggestion& suggestion = suggestions_profile.suggestions(i);
titles.push_back(base::UTF8ToUTF16(suggestion.title()));
urls.push_back(suggestion.url());
- if (suggestion.providers_size()) {
- std::string histogram = base::StringPrintf(
- kImpressionServerHistogramFormat, suggestion.providers(0));
- LogHistogramEvent(histogram, i, num_sites_);
- } else {
- UMA_HISTOGRAM_SPARSE_SLOWLY(kImpressionServerHistogramName, i);
+ // Only log impression metrics on the initial NTP load.
+ if (!initial_load_done_) {
+ if (suggestion.providers_size()) {
+ std::string histogram = base::StringPrintf(
+ kImpressionServerHistogramFormat, suggestion.providers(0));
+ LogHistogramEvent(histogram, i, num_sites_);
+ } else {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(kImpressionServerHistogramName, i);
+ }
}
}
- UMA_HISTOGRAM_SPARSE_SLOWLY(kNumTilesHistogramName, i);
+ if (!initial_load_done_) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY(kNumTilesHistogramName, i);
+ }
+ initial_load_done_ = true;
mv_source_ = SUGGESTIONS_SERVICE;
// Keep a copy of the suggestions for eventual logging.
« no previous file with comments | « chrome/browser/android/most_visited_sites.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698