From 4c881f70fe5cbcc9cc444b035a8ea2f8168f245a Mon Sep 17 00:00:00 2001 From: jiexi Date: Fri, 21 Jul 2023 08:17:56 -0700 Subject: [PATCH] Update "NFT Added" events (#19796) * Update NFT events * remove uneeded toString() * source_connection_method to source for TokenAdded events * redelete add-nft --------- Co-authored-by: Alex Donesky --- app/scripts/metamask-controller.js | 8 +++----- ui/components/app/detected-token/detected-token.js | 2 +- .../confirm-add-suggested-nft.js | 4 ++-- .../confirm-add-suggested-token.js | 2 +- ui/pages/confirm-import-token/confirm-import-token.js | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 5f3c3196b..1ada910e7 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -495,16 +495,14 @@ export default class MetamaskController extends EventEmitter { this.metaMetricsController.trackEvent({ event: MetaMetricsEventName.NftAdded, category: MetaMetricsEventCategory.Wallet, - properties: { + sensitiveProperties: { token_contract_address: address, token_symbol: symbol, - asset_type: AssetType.NFT, + token_id: tokenId, token_standard: standard, + asset_type: AssetType.NFT, source, }, - sensitiveProperties: { - tokenId, - }, }), }, {}, diff --git a/ui/components/app/detected-token/detected-token.js b/ui/components/app/detected-token/detected-token.js index e9deaea9c..af64ee00e 100644 --- a/ui/components/app/detected-token/detected-token.js +++ b/ui/components/app/detected-token/detected-token.js @@ -73,7 +73,7 @@ const DetectedToken = ({ setShowDetectedTokens }) => { token_symbol: importedToken.symbol, token_contract_address: importedToken.address, token_decimal_precision: importedToken.decimals, - source_connection_method: MetaMetricsTokenEventSource.Detected, + source: MetaMetricsTokenEventSource.Detected, token_standard: TokenStandard.ERC20, asset_type: AssetType.token, token_added_type: 'detected', diff --git a/ui/pages/confirm-add-suggested-nft/confirm-add-suggested-nft.js b/ui/pages/confirm-add-suggested-nft/confirm-add-suggested-nft.js index 4285135b9..f49dfe5ff 100644 --- a/ui/pages/confirm-add-suggested-nft/confirm-add-suggested-nft.js +++ b/ui/pages/confirm-add-suggested-nft/confirm-add-suggested-nft.js @@ -69,12 +69,12 @@ const ConfirmAddSuggestedNFT = () => { event: MetaMetricsEventName.NftAdded, category: MetaMetricsEventCategory.Wallet, sensitiveProperties: { + token_contract_address: asset.address, token_symbol: asset.symbol, token_id: asset.tokenId, - token_contract_address: asset.address, - source_connection_method: MetaMetricsTokenEventSource.Dapp, token_standard: asset.standard, asset_type: AssetType.NFT, + source: MetaMetricsTokenEventSource.Dapp, }, }); }), diff --git a/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.js b/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.js index 9867e144b..a972ae455 100644 --- a/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.js +++ b/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.js @@ -132,7 +132,7 @@ const ConfirmAddSuggestedToken = () => { token_contract_address: asset.address, token_decimal_precision: asset.decimals, unlisted: asset.unlisted, - source_connection_method: MetaMetricsTokenEventSource.Dapp, + source: MetaMetricsTokenEventSource.Dapp, token_standard: TokenStandard.ERC20, asset_type: AssetType.token, }, diff --git a/ui/pages/confirm-import-token/confirm-import-token.js b/ui/pages/confirm-import-token/confirm-import-token.js index f0e37909a..61bc41ff4 100644 --- a/ui/pages/confirm-import-token/confirm-import-token.js +++ b/ui/pages/confirm-import-token/confirm-import-token.js @@ -51,7 +51,7 @@ const ConfirmImportToken = () => { token_contract_address: pendingToken.address, token_decimal_precision: pendingToken.decimals, unlisted: pendingToken.unlisted, - source_connection_method: pendingToken.isCustom + source: pendingToken.isCustom ? MetaMetricsTokenEventSource.Custom : MetaMetricsTokenEventSource.List, token_standard: TokenStandard.ERC20,