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

Unified Diff: chrome/browser/resources/local_ntp/most_visited_util.js

Issue 111423005: [Most Visited] Log suggestion provider to UMA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaning Created 7 years 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
Index: chrome/browser/resources/local_ntp/most_visited_util.js
diff --git a/chrome/browser/resources/local_ntp/most_visited_util.js b/chrome/browser/resources/local_ntp/most_visited_util.js
index bd389ae09a9d1efd6521e674bd65aa78c5931bfb..cd95ad47a67d6ddb7b819d83d89053d237bf8b68 100644
--- a/chrome/browser/resources/local_ntp/most_visited_util.js
+++ b/chrome/browser/resources/local_ntp/most_visited_util.js
@@ -70,9 +70,12 @@ function parseQueryParams(location) {
* @param {string|undefined} ping If specified, a location relative to the
* referrer of this iframe, to ping when the link is clicked. Only works if
* the referrer is HTTPS.
+ * @param {string|undefined} provider A provider name (max 8 alphanumeric
+ * characters) used for logging. Undefined if suggestion is not coming from
+ * the server.
* @return {HTMLAnchorElement} A new link element.
*/
-function createMostVisitedLink(params, href, title, text, ping) {
+function createMostVisitedLink(params, href, title, text, ping, provider) {
var styles = getMostVisitedStyles(params, !!text);
var link = document.createElement('a');
link.style.color = styles.color;
@@ -82,6 +85,8 @@ function createMostVisitedLink(params, href, title, text, ping) {
link.href = href;
if ('pos' in params && isFinite(params.pos)) {
link.ping = '/log.html?pos=' + params.pos;
+ if (provider)
+ link.ping += '&pr=' + provider;
// If a ping parameter was specified, add it to the list of pings, relative
// to the referrer of this iframe, which is the default search provider.
if (ping) {
@@ -162,6 +167,7 @@ function fillMostVisited(location, fill) {
data.direction = params.di || '';
data.domain = params.dom || '';
data.ping = params.ping || '';
+ data.provider = params.pr || '';
beaudoin 2013/12/12 19:37:21 I suggest: params.pr || SERVER; With SERVER bein
Mathieu 2013/12/12 21:39:13 Done.
// Log the fact that suggestion was obtained from the server.
var ntpApiHandle = chrome.embeddedSearch.newTabPage;
ntpApiHandle.logEvent(NTP_LOGGING_EVENT_TYPE.NTP_SERVER_SIDE_SUGGESTION);
@@ -174,7 +180,8 @@ function fillMostVisited(location, fill) {
}
if (/^javascript:/i.test(data.url) ||
/^javascript:/i.test(data.thumbnailUrl) ||
- /^javascript:/i.test(data.thumbnailUrl2))
+ /^javascript:/i.test(data.thumbnailUrl2) ||
+ (data.provider && !/^[a-z0-9]{0,8}$/i.test(data.provider)))
return;
if (data.direction)
document.body.dir = data.direction;

Powered by Google App Engine
This is Rietveld 408576698