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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java

Issue 2016913004: Track age and score of snippets that are shown (along with position). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snippets-clicks-retake
Patch Set: Rebase #3 Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java
index a2d81a1bdf3a5c9a277af5770f53d1abe4b73ab6..860aacf5c42d132ff747b81845f004890a6d04f8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java
@@ -95,22 +95,7 @@ public class SnippetArticle implements NewTabPageListItem {
RecordHistogram.recordSparseSlowlyHistogram("NewTabPage.Snippets.CardClicked", mPosition);
NewTabPageUma.recordSnippetAction(NewTabPageUma.SNIPPETS_ACTION_CLICKED);
NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_SNIPPET);
-
- // Track how the (approx.) position relates to age / score of the snippet that is clicked.
- int ageInMinutes =
- (int) ((System.currentTimeMillis() - mPublishTimestampMilliseconds) / 60000L);
- recordAge("NewTabPage.Snippets.CardClickedAge", ageInMinutes);
- recordScore("NewTabPage.Snippets.CardClickedScore", mScore);
- int startPosition = 0;
- for (int endPosition : HISTOGRAM_FOR_POSITIONS) {
- if (mPosition >= startPosition && mPosition <= endPosition) {
- String suffix = "_" + startPosition + "_" + endPosition;
- recordAge("NewTabPage.Snippets.CardClickedAge" + suffix, ageInMinutes);
- recordScore("NewTabPage.Snippets.CardClickedScore" + suffix, mScore);
- break;
- }
- startPosition = endPosition + 1;
- }
+ recordAgeAndScore("NewTabPage.Snippets.CardClicked");
}
/** Tracks impression of this NTP snippet. */
@@ -119,6 +104,7 @@ public class SnippetArticle implements NewTabPageListItem {
if (mImpressionTracked) return;
RecordHistogram.recordSparseSlowlyHistogram("NewTabPage.Snippets.CardShown", mPosition);
+ recordAgeAndScore("NewTabPage.Snippets.CardShown");
mImpressionTracked = true;
}
@@ -127,6 +113,24 @@ public class SnippetArticle implements NewTabPageListItem {
return mImpressionTracked;
}
+ private void recordAgeAndScore(String histogramPrefix) {
+ // Track how the (approx.) position relates to age / score of the snippet that is clicked.
+ int ageInMinutes =
+ (int) ((System.currentTimeMillis() - mPublishTimestampMilliseconds) / 60000L);
+ recordAge(histogramPrefix + "Age", ageInMinutes);
+ recordScore(histogramPrefix + "Score", mScore);
+ int startPosition = 0;
+ for (int endPosition : HISTOGRAM_FOR_POSITIONS) {
+ if (mPosition >= startPosition && mPosition <= endPosition) {
+ String suffix = "_" + startPosition + "_" + endPosition;
+ recordAge(histogramPrefix + "Age" + suffix, ageInMinutes);
+ recordScore(histogramPrefix + "Score" + suffix, mScore);
+ break;
+ }
+ startPosition = endPosition + 1;
+ }
+ }
+
private static void recordAge(String histogramName, int ageInMinutes) {
// Negative values (when the time of the device is set inappropriately) provide no value.
if (ageInMinutes >= 0) {
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698