Skip to content

Commit

Permalink
[WebChannels] Record metrics for follow option tapped in three dot menu
Browse files Browse the repository at this point in the history
Record metrics for follow option tapped in both old tools menu and
the new overflow menu.

Add new user actions relating to follow in actions.xml.

(cherry picked from commit 3fcb8f5)

Bug: 1324452
Change-Id: Ie796abcb6ebf83e49331e0b9503285852f1074ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3645431
Reviewed-by: Weilun Shi <sweilun@chromium.org>
Reviewed-by: Ella Ge <eirage@chromium.org>
Reviewed-by: Sergio Collazos <sczs@chromium.org>
Commit-Queue: Tina Wang <tinazwang@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1003251}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3653005
Commit-Queue: Weilun Shi <sweilun@chromium.org>
Auto-Submit: Tina Wang <tinazwang@chromium.org>
Cr-Commit-Position: refs/branch-heads/5060@{#72}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Tina Wang authored and Chromium LUCI CQ committed May 18, 2022
1 parent 79d84d3 commit f1e2388
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,9 @@ - (void)updateFollowMenuItemWithFollowWebPageURLs:
: @"popup_menu_follow"];
__weak __typeof(self) weakSelf = self;
self.followAction.handler = ^{
RecordAction(status ? UserMetricsAction("MobileMenuUnfollow")
: UserMetricsAction("MobileMenuFollow"));
// TODO(crbug.com/1324452): Record histogram.
[weakSelf updateFollowStatus:!status withFollowWebPageURLs:webPageURLs];
};
}
Expand Down
8 changes: 8 additions & 0 deletions ios/chrome/browser/ui/popup_menu/popup_menu_mediator.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "base/mac/foundation_util.h"
#import "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/strings/sys_string_conversions.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
Expand Down Expand Up @@ -89,6 +91,9 @@
#error "This file requires ARC support."
#endif

using base::RecordAction;
using base::UserMetricsAction;

namespace {
PopupMenuToolsItem* CreateTableViewItem(int titleID,
PopupMenuAction action,
Expand Down Expand Up @@ -651,6 +656,9 @@ - (void)searchCopiedImage {

- (void)updateFollowStatus {
DCHECK(IsWebChannelsEnabled());
RecordAction(self.followStatus ? UserMetricsAction("MobileMenuUnfollow")
: UserMetricsAction("MobileMenuFollow"));
// TODO(crbug.com/1324452): Record histogram.
ios::GetChromeBrowserProvider().GetFollowProvider()->UpdateFollowStatus(
self.webPageURLs, !self.followStatus);
}
Expand Down
14 changes: 14 additions & 0 deletions tools/metrics/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17671,6 +17671,13 @@ should be able to be added at any place in this file.
<description>User pressed 'Find in page' in the app menu.</description>
</action>

<action name="MobileMenuFollow">
<owner>adamta@google.org</owner>
<owner>sczs@chromium.org</owner>
<owner>tinazwang@chromium.org</owner>
<description>User pressed the follow option in the app menu.</description>
</action>

<action name="MobileMenuForward">
<owner>aurimas@chromium.org</owner>
<description>User pressed the forward icon in the app menu.</description>
Expand Down Expand Up @@ -17883,6 +17890,13 @@ should be able to be added at any place in this file.
<description>User pressed the 'Translate' in the app menu.</description>
</action>

<action name="MobileMenuUnfollow">
<owner>adamta@google.org</owner>
<owner>sczs@chromium.org</owner>
<owner>tinazwang@chromium.org</owner>
<description>User pressed the unfollow option in the app menu.</description>
</action>

<action name="MobileMenuVoiceSearch">
<owner>gambard@chromium.org</owner>
<description>User pressed 'Voice Search' in the app menu.</description>
Expand Down

0 comments on commit f1e2388

Please sign in to comment.