From b3fa1e534e9ca2f10043a58794ae8dd39ec72c5f Mon Sep 17 00:00:00 2001 From: Brad Decker Date: Sat, 21 Nov 2020 09:38:43 -0600 Subject: [PATCH] add version to page events (#9926) --- ui/app/contexts/metametrics.new.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/app/contexts/metametrics.new.js b/ui/app/contexts/metametrics.new.js index f8596b796..75249444f 100644 --- a/ui/app/contexts/metametrics.new.js +++ b/ui/app/contexts/metametrics.new.js @@ -83,6 +83,12 @@ export function MetaMetricsProvider({ children }) { const context = useSegmentContext() const network = useSelector(getMetricsNetworkIdentifier) const chainId = useSelector(getCurrentChainId) + // Temporary until the background controller refactor merges: + const baseVersion = global.platform.getVersion() + const version = + process.env.METAMASK_ENVIRONMENT === 'production' + ? baseVersion + : `${baseVersion}-${process.env.METAMASK_ENVIRONMENT}` /** * track a metametrics event @@ -171,13 +177,17 @@ export function MetaMetricsProvider({ children }) { network, environment_type: environmentType, }, - context, + context: { + ...context, + version, + }, }) } previousMatch.current = match?.path } }, [ location, + version, locale, context, network,