mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fix METAMASK-GH2B (#9900)
This commit is contained in:
parent
e4de763116
commit
520ad05790
@ -127,7 +127,8 @@ export function MetaMetricsProvider({ children }) {
|
|||||||
location.pathname.startsWith('/initialize')) ||
|
location.pathname.startsWith('/initialize')) ||
|
||||||
participateInMetaMetrics
|
participateInMetaMetrics
|
||||||
) {
|
) {
|
||||||
// Events that happen during initialization before the user opts into MetaMetrics will be anonymous
|
// Events that happen during initialization before the user opts into
|
||||||
|
// MetaMetrics will be anonymous
|
||||||
const idTrait = metaMetricsId ? 'userId' : 'anonymousId'
|
const idTrait = metaMetricsId ? 'userId' : 'anonymousId'
|
||||||
const idValue = metaMetricsId ?? METAMETRICS_ANONYMOUS_ID
|
const idValue = metaMetricsId ?? METAMETRICS_ANONYMOUS_ID
|
||||||
const match = matchPath(location.pathname, {
|
const match = matchPath(location.pathname, {
|
||||||
@ -135,19 +136,15 @@ export function MetaMetricsProvider({ children }) {
|
|||||||
exact: true,
|
exact: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
})
|
})
|
||||||
// Start by checking for a missing match route. If this falls through to the else if, then we know we
|
// Start by checking for a missing match route. If this falls through to
|
||||||
// have a matched route for tracking.
|
// the else if, then we know we have a matched route for tracking.
|
||||||
if (!match) {
|
if (!match) {
|
||||||
// We have more specific pages for each type of transaction confirmation
|
captureMessage(`Segment page tracking found unmatched route`, {
|
||||||
// The user lands on /confirm-transaction first, then is redirected based on
|
extra: {
|
||||||
// the contents of state.
|
|
||||||
if (location.pathname !== '/confirm-transaction') {
|
|
||||||
// Otherwise we are legitimately missing a matching route
|
|
||||||
captureMessage(`Segment page tracking found unmatched route`, {
|
|
||||||
previousMatch,
|
previousMatch,
|
||||||
currentPath: location.pathname,
|
currentPath: location.pathname,
|
||||||
})
|
},
|
||||||
}
|
})
|
||||||
} else if (
|
} else if (
|
||||||
previousMatch.current !== match.path &&
|
previousMatch.current !== match.path &&
|
||||||
!(
|
!(
|
||||||
@ -156,9 +153,11 @@ export function MetaMetricsProvider({ children }) {
|
|||||||
previousMatch.current === undefined
|
previousMatch.current === undefined
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
// When a notification window is open by a Dapp we do not want to track the initial home route load that can
|
// When a notification window is open by a Dapp we do not want to track
|
||||||
// sometimes happen. To handle this we keep track of the previousMatch, and we skip the event track in the event
|
// the initial home route load that can sometimes happen. To handle
|
||||||
// that we are dealing with the initial load of the homepage
|
// this we keep track of the previousMatch, and we skip the event track
|
||||||
|
// in the event that we are dealing with the initial load of the
|
||||||
|
// homepage
|
||||||
const { path, params } = match
|
const { path, params } = match
|
||||||
const name = PATH_NAME_MAP[path]
|
const name = PATH_NAME_MAP[path]
|
||||||
segment.page({
|
segment.page({
|
||||||
|
@ -99,6 +99,8 @@ const PATH_NAME_MAP = {
|
|||||||
[`${CONNECT_ROUTE}/:id${CONNECT_CONFIRM_PERMISSIONS_ROUTE}`]: 'Grant Connected Site Permissions Confirmation Page',
|
[`${CONNECT_ROUTE}/:id${CONNECT_CONFIRM_PERMISSIONS_ROUTE}`]: 'Grant Connected Site Permissions Confirmation Page',
|
||||||
[CONNECTED_ROUTE]: 'Sites Connected To This Account Page',
|
[CONNECTED_ROUTE]: 'Sites Connected To This Account Page',
|
||||||
[CONNECTED_ACCOUNTS_ROUTE]: 'Accounts Connected To This Site Page',
|
[CONNECTED_ACCOUNTS_ROUTE]: 'Accounts Connected To This Site Page',
|
||||||
|
[`${CONFIRM_TRANSACTION_ROUTE}/:id`]: 'Confirmation Root Page',
|
||||||
|
[CONFIRM_TRANSACTION_ROUTE]: 'Confirmation Root Page',
|
||||||
[`${CONFIRM_TRANSACTION_ROUTE}/:id${CONFIRM_TOKEN_METHOD_PATH}`]: 'Confirm Token Method Transaction Page',
|
[`${CONFIRM_TRANSACTION_ROUTE}/:id${CONFIRM_TOKEN_METHOD_PATH}`]: 'Confirm Token Method Transaction Page',
|
||||||
[`${CONFIRM_TRANSACTION_ROUTE}/:id${CONFIRM_SEND_ETHER_PATH}`]: 'Confirm Send Ether Transaction Page',
|
[`${CONFIRM_TRANSACTION_ROUTE}/:id${CONFIRM_SEND_ETHER_PATH}`]: 'Confirm Send Ether Transaction Page',
|
||||||
[`${CONFIRM_TRANSACTION_ROUTE}/:id${CONFIRM_SEND_TOKEN_PATH}`]: 'Confirm Send Token Transaction Page',
|
[`${CONFIRM_TRANSACTION_ROUTE}/:id${CONFIRM_SEND_TOKEN_PATH}`]: 'Confirm Send Token Transaction Page',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user