Skip to content

Commit

Permalink
[NTP Snippets] Add UMA for snippet dismissal
Browse files Browse the repository at this point in the history
BUG=603576

Review URL: https://codereview.chromium.org/1882953004

Cr-Commit-Position: refs/heads/master@{#387576}
  • Loading branch information
dgn authored and Commit bot committed Apr 15, 2016
1 parent 2f5112e commit 251cd6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ public void onLoadingComplete(MostVisitedItem[] items) {
@Override
public void onSnippetDismissed(SnippetArticle dismissedSnippet) {
if (mIsDestroyed) return;
NewTabPageUma.recordSnippetAction(NewTabPageUma.SNIPPETS_ACTION_DISMISSED);
mSnippetsBridge.discardSnippet(dismissedSnippet);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public class NewTabPageUma {
private static final int NUM_NTP_IMPRESSION = 2;

/** Possible interactions with the snippets. */
@IntDef({SNIPPETS_ACTION_SHOWN, SNIPPETS_ACTION_SCROLLED, SNIPPETS_ACTION_CLICKED})
@IntDef({SNIPPETS_ACTION_SHOWN, SNIPPETS_ACTION_SCROLLED, SNIPPETS_ACTION_CLICKED,
SNIPPETS_ACTION_DISMISSED})
@Retention(RetentionPolicy.SOURCE)
public @interface SnippetsAction {}
/** Snippets are enabled and are being shown to the user. */
Expand All @@ -70,8 +71,10 @@ public class NewTabPageUma {
public static final int SNIPPETS_ACTION_SCROLLED = 1;
/** A snippet has been clicked. */
public static final int SNIPPETS_ACTION_CLICKED = 2;
/** A snippet has been swiped away. */
public static final int SNIPPETS_ACTION_DISMISSED = 3;
/** The number of possible actions. */
private static final int NUM_SNIPPETS_ACTIONS = 3;
private static final int NUM_SNIPPETS_ACTIONS = 4;

/**
* Records an action taken by the user on the NTP.
Expand Down
1 change: 1 addition & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83765,6 +83765,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="0" label="Snippets were shown to the user"/>
<int value="1" label="User scrolled through the snippets"/>
<int value="2" label="User clicked on a snippet into the host website"/>
<int value="3" label="User swiped a snippet away"/>
</enum>

<enum name="SocketStreamConnectionType" type="int">
Expand Down

0 comments on commit 251cd6e

Please sign in to comment.