2020-06-01 19:54:32 +02:00
|
|
|
import { getBackgroundMetaMetricState } from '../../../ui/app/selectors'
|
2020-01-09 04:34:58 +01:00
|
|
|
import { sendMetaMetricsEvent } from '../../../ui/app/helpers/utils/metametrics.util'
|
2019-04-29 08:18:40 +02:00
|
|
|
|
|
|
|
const inDevelopment = process.env.NODE_ENV === 'development'
|
|
|
|
|
|
|
|
const METAMETRICS_TRACKING_URL = inDevelopment
|
|
|
|
? 'http://www.metamask.io/metametrics'
|
|
|
|
: 'http://www.metamask.io/metametrics-prod'
|
|
|
|
|
2020-05-06 00:19:38 +02:00
|
|
|
export default function backEndMetaMetricsEvent (metaMaskState, eventData) {
|
2020-06-01 19:54:32 +02:00
|
|
|
const stateEventData = getBackgroundMetaMetricState({ metamask: metaMaskState })
|
2019-04-29 08:18:40 +02:00
|
|
|
|
|
|
|
if (stateEventData.participateInMetaMetrics) {
|
2019-07-31 22:17:11 +02:00
|
|
|
sendMetaMetricsEvent({
|
|
|
|
...stateEventData,
|
|
|
|
...eventData,
|
|
|
|
url: METAMETRICS_TRACKING_URL + '/backend',
|
|
|
|
})
|
2019-04-29 08:18:40 +02:00
|
|
|
}
|
|
|
|
}
|