2020-05-02 21:41:17 +02:00
|
|
|
import { getMetaMetricState } 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) {
|
2019-04-29 08:18:40 +02:00
|
|
|
const stateEventData = getMetaMetricState({ metamask: metaMaskState })
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|