Commit cef3357d authored by Tanisha Mandre's avatar Tanisha Mandre Committed by Commit Bot

Add credit card scanner feature related metrics

- MobileAddCreditCard.CreditCardAdded: When a valid credit card is saved.
- MobileAddCreditCard.AddPaymentMethodButton: When the 'Add Payment method' button is tapped.
- MobileAddCreditCard.UseCameraButton: When a user tries to scan a credit card by tapping the 'Use Camera' button.
- obileCreditCardScanner.ScannedCardNumberModified: When a user scans a credit card using the Credit Card Scanner but corrects the scanned number.
- MobileCreditCardScanner.ScannedExpiryMonthModified: When a user scans a credit card using the Credit Card Scanner but corrects the scanned expiry month.
- MobileCreditCardScanner.ScannedExpiryYearModified: When a user scans a credit card using the Credit Card Scanner but corrects the scanned expiry year.

Bug: 989432

Change-Id: I0b0500dbced496eb47deee1d448a2fcb6790dc67
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1784615
Commit-Queue: Tanisha Mandre <tanishamandre@google.com>
Reviewed-by: default avatarJavier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697580}
parent bad8cb95
......@@ -92,7 +92,7 @@
self.personalDataManager->UpdateCreditCard(savedCreditCardCopy);
} else {
base::RecordAction(
base::UserMetricsAction("MobileAddCreditCard.CardSaved"));
base::UserMetricsAction("MobileAddCreditCard.CreditCardAdded"));
self.personalDataManager->AddCreditCard(creditCard);
}
......
......@@ -6,6 +6,7 @@
#include "base/feature_list.h"
#include "base/mac/foundation_util.h"
#include "base/metrics/user_metrics.h"
#import "ios/chrome/browser/ui/autofill/cells/autofill_edit_item.h"
#import "ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_view_controller_delegate.h"
#import "ios/chrome/browser/ui/settings/autofill/features.h"
......@@ -66,6 +67,15 @@ typedef NS_ENUM(NSInteger, ItemType) {
// the UI.
@property(nonatomic, strong) NSString* expirationYear;
// The card number scanned using the credit card scanner.
@property(nonatomic, strong) NSString* scannedCardNumber;
// The expiration month scanned using the credit card scanner.
@property(nonatomic, strong) NSString* scannedExpirationMonth;
// The expiration year scanned using the credit card scanner.
@property(nonatomic, strong) NSString* scannedExpirationYear;
@end
@implementation AutofillAddCreditCardViewController
......@@ -252,18 +262,21 @@ typedef NS_ENUM(NSInteger, ItemType) {
expirationMonth:(NSString*)expirationMonth
expirationYear:(NSString*)expirationYear {
if (cardNumber) {
self.scannedCardNumber = cardNumber;
[self updateCellForItemType:ItemTypeCardNumber
inSectionIdentifier:SectionIdentifierCreditCardDetails
withText:cardNumber];
}
if (expirationMonth) {
self.scannedExpirationMonth = expirationMonth;
[self updateCellForItemType:ItemTypeExpirationMonth
inSectionIdentifier:SectionIdentifierCreditCardDetails
withText:expirationMonth];
}
if (expirationYear) {
self.scannedExpirationYear = expirationYear;
[self updateCellForItemType:ItemTypeExpirationYear
inSectionIdentifier:SectionIdentifierCreditCardDetails
withText:expirationYear];
......@@ -276,6 +289,23 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (void)didTapAddButton:(id)sender {
[self updateCreditCardData];
// Metrics logged if the data scanned using the credit card scanner is
// modified by the user.
if (self.scannedCardNumber && self.cardNumber != self.scannedCardNumber) {
base::RecordAction(base::UserMetricsAction(
"MobileCreditCardScannerScannedCardNumberModified"));
}
if (self.scannedExpirationMonth &&
self.expirationMonth != self.scannedExpirationMonth) {
base::RecordAction(base::UserMetricsAction(
"MobileCreditCardScannerScannedExpiryMonthModified"));
}
if (self.scannedExpirationYear &&
self.expirationYear != self.scannedExpirationYear) {
base::RecordAction(base::UserMetricsAction(
"MobileCreditCardScannerScannedExpiryYearModified"));
}
[self.delegate addCreditCardViewController:self
addCreditCardWithHolderName:self.cardHolderName
cardNumber:self.cardNumber
......@@ -360,6 +390,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
// Presents the credit card scanner camera screen.
- (void)handleCameraButton {
base::RecordAction(
base::UserMetricsAction("MobileAddCreditCard.UseCameraButton"));
[self.delegate addCreditCardViewControllerDidUseCamera:self];
}
......
......@@ -11550,16 +11550,23 @@ should be able to be added at any place in this file.
<action name="MobileAddCreditCard.AddPaymentMethodButton">
<owner>gambard@chromium.org</owner>
<description>
The user tapped on &quot;Add Payment Method...&quot; in the Settings,
Payment Methods menu.
User tapped on &quot;Add Payment Method&quot; using the settings payment
methods screen.
</description>
</action>
<action name="MobileAddCreditCard.CardSaved">
<action name="MobileAddCreditCard.CreditCardAdded">
<owner>gambard@chromium.org</owner>
<description>
The user saved a new credit card by tapping on &quot;Add&quot; in the
Settings, Add Payment Methods menu.
User adds a valid credit card using the add credit card screen.
</description>
</action>
<action name="MobileAddCreditCard.UseCameraButton">
<owner>gambard@chromium.org</owner>
<description>
User tapped on &quot;Use Camera&quot; from the settings add credit card
screen.
</description>
</action>
......@@ -11981,27 +11988,51 @@ should be able to be added at any place in this file.
<description>Please enter the description of this user action.</description>
</action>
<action name="MobileCreditCardScannerClose">
<action name="MobileCreditCardScanner.Close">
<owner>gambard@chromium.org</owner>
<description>
User closed the Credit Card Scanner without scanning a credit card.
</description>
</action>
<action name="MobileCreditCardScannerError">
<action name="MobileCreditCardScanner.Error">
<owner>gambard@chromium.org</owner>
<description>
User closed the Credit Card Scanner from an error dialog.
</description>
</action>
<action name="MobileCreditCardScannerScannedCard">
<action name="MobileCreditCardScanner.ScannedCard">
<owner>gambard@chromium.org</owner>
<description>
User scanned a credit card using the Credit Card Scanner.
</description>
</action>
<action name="MobileCreditCardScanner.ScannedCardNumberModified">
<owner>gambard@chromium.org</owner>
<description>
User scanned a credit card using the Credit Card Scanner and scanned card
number was modified.
</description>
</action>
<action name="MobileCreditCardScanner.ScannedExpiryMonthModified">
<owner>gambard@chromium.org</owner>
<description>
User scanned a credit card using the Credit Card Scanner and scanned card
expiry month was modified.
</description>
</action>
<action name="MobileCreditCardScanner.ScannedExpiryYearModified">
<owner>gambard@chromium.org</owner>
<description>
User scanned a credit card using the Credit Card Scanner and scanned card
expiry year was modified.
</description>
</action>
<action name="MobileCustomFeedback">
<obsolete>
Deprecated 12/2018. CustomFeedback never shipped to 100% and is no longer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment