Skip to content

Commit

Permalink
[iOS] Fix feed opens overlogging
Browse files Browse the repository at this point in the history
The feed metrics recorder had 2 issues causing overlogging of opens:
1) Two functions were using the same histogram
2) 'recordCardTappedAtIndex' is being called multiple times per tap

As a solution, we remove recordCardTappedAtIndex's logging. This
causes us to lose the index of the opened card, but we can get this
data in Roboslicer.

(cherry picked from commit 3dbac0e)

Bug: 1395128
Change-Id: Ifeb649d32f20f0d1ede1c3aba62a70cdccda80c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4071944
Reviewed-by: Tina Wang <tinazwang@chromium.org>
Commit-Queue: Adam Arcaro <adamta@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#1078237}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4081109
Auto-Submit: Adam Arcaro <adamta@google.com>
Commit-Queue: Tina Wang <tinazwang@chromium.org>
Cr-Commit-Position: refs/branch-heads/5359@{#1090}
Cr-Branched-From: 27d3765-refs/heads/main@{#1058933}
  • Loading branch information
adamta authored and Chromium LUCI CQ committed Dec 5, 2022
1 parent 315f216 commit fd51487
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
12 changes: 4 additions & 8 deletions ios/chrome/browser/ui/ntp/metrics/feed_metrics_constants.h
Expand Up @@ -193,12 +193,6 @@ extern const char kDiscoverFeedCardShownAtIndex[];
// Histogram name for a Following feed card shown at index.
extern const char kFollowingFeedCardShownAtIndex[];

// Histogram name for a Discover feed card tapped at index.
extern const char kDiscoverFeedCardOpenedAtIndex[];

// Histogram name for a Following feed card tapped at index.
extern const char kFollowingFeedCardOpenedAtIndex[];

// Histogram name to capture Feed Notice card impressions.
extern const char kDiscoverFeedNoticeCardFulfilled[];

Expand Down Expand Up @@ -230,10 +224,12 @@ extern const char kDiscoverFeedUploadActionsNetworkDurationFailure[];
// operation.
extern const char kDiscoverFeedNetworkDuration[];

// Histogram name to measure opened URL's regardless of the surface they were
// opened in.
// Histogram name to track opened articles from the Discover feed.
extern const char kDiscoverFeedURLOpened[];

// Histogram name to track opened articles from the Following feed.
extern const char kFollowingFeedURLOpened[];

// Histogram name to capture if the last Feed fetch had logging enabled.
extern const char kDiscoverFeedActivityLoggingEnabled[];

Expand Down
5 changes: 1 addition & 4 deletions ios/chrome/browser/ui/ntp/metrics/feed_metrics_constants.mm
Expand Up @@ -34,10 +34,6 @@
"NewTabPage.ContentSuggestions.Shown";
const char kFollowingFeedCardShownAtIndex[] =
"ContentSuggestions.Feed.WebFeed.Shown";
const char kDiscoverFeedCardOpenedAtIndex[] =
"NewTabPage.ContentSuggestions.Opened";
const char kFollowingFeedCardOpenedAtIndex[] =
"ContentSuggestions.Feed.WebFeed.Opened";
const char kDiscoverFeedNoticeCardFulfilled[] =
"ContentSuggestions.Feed.NoticeCardFulfilled2";
const char kDiscoverFeedArticlesFetchNetworkDurationSuccess[] =
Expand All @@ -55,6 +51,7 @@
const char kDiscoverFeedNetworkDuration[] =
"ContentSuggestions.Feed.Network.Duration";
const char kDiscoverFeedURLOpened[] = "NewTabPage.ContentSuggestions.Opened";
const char kFollowingFeedURLOpened[] = "ContentSuggestions.Feed.WebFeed.Opened";
const char kDiscoverFeedActivityLoggingEnabled[] =
"ContentSuggestions.Feed.ActivityLoggingEnabled";
const char kDiscoverFeedBrokenNTPHierarchy[] =
Expand Down
20 changes: 9 additions & 11 deletions ios/chrome/browser/ui/ntp/metrics/feed_metrics_recorder.mm
Expand Up @@ -343,15 +343,8 @@ - (void)recordCardShownAtIndex:(int)index {
}

- (void)recordCardTappedAtIndex:(int)index {
switch ([self.feedControlDelegate selectedFeed]) {
case FeedTypeDiscover:
UMA_HISTOGRAM_EXACT_LINEAR(kDiscoverFeedCardOpenedAtIndex, index,
kMaxCardsInFeed);
break;
case FeedTypeFollowing:
UMA_HISTOGRAM_EXACT_LINEAR(kFollowingFeedCardOpenedAtIndex, index,
kMaxCardsInFeed);
}
// TODO(crbug.com/1174088): No-op since this function gets called multiple
// times for a tap. Log index when this is fixed.
}

- (void)recordNoticeCardShown:(BOOL)shown {
Expand Down Expand Up @@ -997,8 +990,13 @@ - (void)recordOpenURL {
IOSContentSuggestionsActionType::kFeedCard);
}

// TODO(crbug.com/1174088): Add card Index and the max number of suggestions.
UMA_HISTOGRAM_EXACT_LINEAR(kDiscoverFeedURLOpened, 0, 1);
switch ([self.feedControlDelegate selectedFeed]) {
case FeedTypeDiscover:
UMA_HISTOGRAM_EXACT_LINEAR(kDiscoverFeedURLOpened, 0, 1);
break;
case FeedTypeFollowing:
UMA_HISTOGRAM_EXACT_LINEAR(kFollowingFeedURLOpened, 0, 1);
}
}

#pragma mark - Converters
Expand Down

0 comments on commit fd51487

Please sign in to comment.