summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeaudoin@chromium.org <beaudoin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-05 18:20:25 +0000
committerbeaudoin@chromium.org <beaudoin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-05 18:20:25 +0000
commit97063c3e2f54db0b01cc612a590eeb7ac478f5a2 (patch)
tree56f52875bba222258190f4f6369595c8e9e5c914
parent46bca10dadfbd2e59ac36d09bb2a890bd0bee6ce (diff)
downloadchromium_src-97063c3e2f54db0b01cc612a590eeb7ac478f5a2.zip
chromium_src-97063c3e2f54db0b01cc612a590eeb7ac478f5a2.tar.gz
chromium_src-97063c3e2f54db0b01cc612a590eeb7ac478f5a2.tar.bz2
Ensure the 1993 NTP logs to UMA Most Visited tiles that use the fallback thumbnail instead of the preferred one.
TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/23874005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221463 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/local_ntp/most_visited_thumbnail.js2
-rw-r--r--chrome/browser/resources/local_ntp/most_visited_util.js11
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc27
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_user_data_logger.h8
-rw-r--r--chrome/common/ntp_logging_events.h11
-rw-r--r--tools/metrics/histograms/histograms.xml11
6 files changed, 63 insertions, 7 deletions
diff --git a/chrome/browser/resources/local_ntp/most_visited_thumbnail.js b/chrome/browser/resources/local_ntp/most_visited_thumbnail.js
index 8952d70..dd3f4fd 100644
--- a/chrome/browser/resources/local_ntp/most_visited_thumbnail.js
+++ b/chrome/browser/resources/local_ntp/most_visited_thumbnail.js
@@ -51,9 +51,11 @@ window.addEventListener('DOMContentLoaded', function() {
// The first thumbnail's onerror function will swap the visibility of
// the two thumbnails.
image.onerror = function() {
+ logEvent(NTP_LOGGING_EVENT_TYPE.NTP_FALLBACK_THUMBNAIL_USED);
image.style.visibility = 'hidden';
image2.style.visibility = 'visible';
};
+ logEvent(NTP_LOGGING_EVENT_TYPE.NTP_FALLBACK_THUMBNAIL_REQUESTED);
} else {
image.onerror = showDomainElement;
}
diff --git a/chrome/browser/resources/local_ntp/most_visited_util.js b/chrome/browser/resources/local_ntp/most_visited_util.js
index 446b7ca..3e058bc 100644
--- a/chrome/browser/resources/local_ntp/most_visited_util.js
+++ b/chrome/browser/resources/local_ntp/most_visited_util.js
@@ -19,8 +19,15 @@ var NTP_LOGGING_EVENT_TYPE = {
NTP_MOUSEOVER: 0,
// The page attempted to load a thumbnail image.
NTP_THUMBNAIL_ATTEMPT: 1,
- // There was an error in loading a thumbnail image.
- NTP_THUMBNAIL_ERROR: 2
+ // There was an error in loading both the thumbnail image and the fallback
+ // (if it was provided), resulting in a grey tile.
+ NTP_THUMBNAIL_ERROR: 2,
+ // The page attempted to load a thumbnail URL while a fallback thumbnail was
+ // provided.
+ NTP_FALLBACK_THUMBNAIL_REQUESTED: 3,
+ // The primary thumbnail image failed to load and caused us to use the
+ // secondary thumbnail as a fallback.
+ NTP_FALLBACK_THUMBNAIL_USED: 4
};
/**
diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
index 95d86ed..f3383de 100644
--- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
@@ -16,12 +16,23 @@ NTPUserDataLogger::~NTPUserDataLogger() {}
void NTPUserDataLogger::EmitThumbnailErrorRate() {
DCHECK_LE(number_of_thumbnail_errors_, number_of_thumbnail_attempts_);
if (number_of_thumbnail_attempts_ != 0) {
- UMA_HISTOGRAM_PERCENTAGE("NewTabPage.ThumbnailErrorRate",
- GetPercentError(number_of_thumbnail_errors_,
- number_of_thumbnail_attempts_));
+ UMA_HISTOGRAM_PERCENTAGE(
+ "NewTabPage.ThumbnailErrorRate",
+ GetPercentError(number_of_thumbnail_errors_,
+ number_of_thumbnail_attempts_));
+ }
+ DCHECK_LE(number_of_fallback_thumbnails_used_,
+ number_of_fallback_thumbnails_requested_);
+ if (number_of_fallback_thumbnails_requested_ != 0) {
+ UMA_HISTOGRAM_PERCENTAGE(
+ "NewTabPage.ThumbnailFallbackRate",
+ GetPercentError(number_of_fallback_thumbnails_used_,
+ number_of_fallback_thumbnails_requested_));
}
number_of_thumbnail_attempts_ = 0;
number_of_thumbnail_errors_ = 0;
+ number_of_fallback_thumbnails_requested_ = 0;
+ number_of_fallback_thumbnails_used_ = 0;
}
void NTPUserDataLogger::EmitMouseoverCount() {
@@ -40,6 +51,12 @@ void NTPUserDataLogger::LogEvent(NTPLoggingEventType event) {
case NTP_THUMBNAIL_ERROR:
number_of_thumbnail_errors_++;
break;
+ case NTP_FALLBACK_THUMBNAIL_REQUESTED:
+ number_of_fallback_thumbnails_requested_++;
+ break;
+ case NTP_FALLBACK_THUMBNAIL_USED:
+ number_of_fallback_thumbnails_used_++;
+ break;
default:
NOTREACHED();
}
@@ -64,7 +81,9 @@ NTPUserDataLogger::NTPUserDataLogger(content::WebContents* contents)
: content::WebContentsObserver(contents),
number_of_mouseovers_(0),
number_of_thumbnail_attempts_(0),
- number_of_thumbnail_errors_(0) {
+ number_of_thumbnail_errors_(0),
+ number_of_fallback_thumbnails_requested_(0),
+ number_of_fallback_thumbnails_used_(0) {
}
size_t NTPUserDataLogger::GetPercentError(size_t errors, size_t events) const {
diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h
index 41cd59d..dc1df81 100644
--- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h
+++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h
@@ -64,6 +64,14 @@ class NTPUserDataLogger
// of a thumbnail image.
size_t number_of_thumbnail_errors_;
+ // Total number of attempts made to load thumbnail images while providing a
+ // fallback thumbnail for this NTP session.
+ size_t number_of_fallback_thumbnails_requested_;
+
+ // Total number of errors that occurred while trying to load the primary
+ // thumbnail image and that caused a fallback to the secondary thumbnail.
+ size_t number_of_fallback_thumbnails_used_;
+
// The URL of this New Tab Page - varies based on NTP version.
GURL ntp_url_;
diff --git a/chrome/common/ntp_logging_events.h b/chrome/common/ntp_logging_events.h
index 3a95a59..8bc8738 100644
--- a/chrome/common/ntp_logging_events.h
+++ b/chrome/common/ntp_logging_events.h
@@ -13,9 +13,18 @@ enum NTPLoggingEventType {
// The page attempted to load a thumbnail image.
NTP_THUMBNAIL_ATTEMPT = 1,
- // There was an error in loading a thumbnail image.
+ // There was an error in loading both the thumbnail image and the fallback
+ // (if it was provided), resulting in a grey tile.
NTP_THUMBNAIL_ERROR = 2,
+ // The page attempted to load a thumbnail URL while a fallback thumbnail was
+ // provided.
+ NTP_FALLBACK_THUMBNAIL_REQUESTED = 3,
+
+ // The primary thumbnail image failed to load and caused us to use the
+ // secondary thumbnail as a fallback.
+ NTP_FALLBACK_THUMBNAIL_USED = 4,
+
NTP_NUM_EVENT_TYPES
};
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 07d31f9..92a3e21 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -10122,6 +10122,17 @@ other types of suffix sets.
</summary>
</histogram>
+<histogram name="NewTabPage.ThumbnailFallbackRate" units="%">
+ <summary>
+ The percentage of times most visited tiles use the fallback thumbnail. Only
+ requests that actually specify a fallback thumbnail are considered here. We
+ measure the rate instead of the number of errors because multiple attempts
+ are made to load thumbnails at different times during the NTP's lifetime.
+ Each NTP session's error rate is logged after the user navigates to a new
+ URL from that NTP.
+ </summary>
+</histogram>
+
<histogram name="NewTabPage.VisibleScreenshots">
<summary>
The number of screenshots that were cached for the visible suggestions on