mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Only send the rpc origin to segment when calling trackevent for newly added custom networks (#15227)
This commit is contained in:
parent
cbda923c61
commit
4993d28a8f
@ -261,6 +261,13 @@ async function addEthereumChainHandler(
|
||||
}),
|
||||
);
|
||||
|
||||
let rpcUrlOrigin;
|
||||
try {
|
||||
rpcUrlOrigin = new URL(firstValidRPCUrl).origin;
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
sendMetrics({
|
||||
event: 'Custom Network Added',
|
||||
category: EVENT.CATEGORIES.NETWORK,
|
||||
@ -274,13 +281,13 @@ async function addEthereumChainHandler(
|
||||
// property included in all events. For RPC type networks
|
||||
// the MetaMetrics controller uses the rpcUrl for the network
|
||||
// property.
|
||||
network: firstValidRPCUrl,
|
||||
network: rpcUrlOrigin,
|
||||
symbol: ticker,
|
||||
block_explorer_url: firstValidBlockExplorerUrl,
|
||||
source: EVENT.SOURCE.TRANSACTION.DAPP,
|
||||
},
|
||||
sensitiveProperties: {
|
||||
rpc_url: firstValidRPCUrl,
|
||||
rpc_url: rpcUrlOrigin,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -2065,22 +2065,28 @@ export default class MetamaskController extends EventEmitter {
|
||||
},
|
||||
);
|
||||
|
||||
let rpcUrlOrigin;
|
||||
try {
|
||||
rpcUrlOrigin = new URL(rpcUrl).origin;
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
this.metaMetricsController.trackEvent({
|
||||
event: 'Custom Network Added',
|
||||
category: EVENT.CATEGORIES.NETWORK,
|
||||
referrer: {
|
||||
url: rpcUrl,
|
||||
url: rpcUrlOrigin,
|
||||
},
|
||||
properties: {
|
||||
chain_id: chainId,
|
||||
network_name: chainName,
|
||||
network: rpcUrl,
|
||||
network: rpcUrlOrigin,
|
||||
symbol: ticker,
|
||||
block_explorer_url: blockExplorerUrl,
|
||||
source: EVENT.SOURCE.NETWORK.POPULAR_NETWORK_LIST,
|
||||
},
|
||||
sensitiveProperties: {
|
||||
rpc_url: rpcUrl,
|
||||
rpc_url: rpcUrlOrigin,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -512,22 +512,28 @@ const NetworksForm = ({
|
||||
}
|
||||
|
||||
if (addNewNetwork) {
|
||||
let rpcUrlOrigin;
|
||||
try {
|
||||
rpcUrlOrigin = new URL(rpcUrl).origin;
|
||||
} catch {
|
||||
// error
|
||||
}
|
||||
trackEvent({
|
||||
event: 'Custom Network Added',
|
||||
category: EVENT.CATEGORIES.NETWORK,
|
||||
referrer: {
|
||||
url: rpcUrl,
|
||||
url: rpcUrlOrigin,
|
||||
},
|
||||
properties: {
|
||||
chain_id: chainId,
|
||||
network_name: networkName,
|
||||
network: rpcUrl,
|
||||
network: rpcUrlOrigin,
|
||||
symbol: ticker,
|
||||
block_explorer_url: blockExplorerUrl,
|
||||
source: EVENT.SOURCE.NETWORK.CUSTOM_NETWORK_FORM,
|
||||
},
|
||||
sensitiveProperties: {
|
||||
rpc_url: rpcUrl,
|
||||
rpc_url: rpcUrlOrigin,
|
||||
},
|
||||
});
|
||||
dispatch(setNewNetworkAdded(networkName));
|
||||
|
Loading…
x
Reference in New Issue
Block a user