You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
750 B
28 lines
750 B
4 years ago
|
import Analytics from 'analytics-node'
|
||
|
|
||
|
const inDevelopment = process.env.METAMASK_DEBUG || process.env.IN_TEST
|
||
|
|
||
|
const flushAt = inDevelopment ? 1 : undefined
|
||
|
|
||
|
const segmentNoop = {
|
||
|
track () {
|
||
|
// noop
|
||
|
},
|
||
|
page () {
|
||
|
// noop
|
||
|
},
|
||
|
identify () {
|
||
|
// noop
|
||
|
},
|
||
|
}
|
||
|
|
||
|
// We do not want to track events on development builds unless specifically
|
||
|
// provided a SEGMENT_WRITE_KEY. This also holds true for test environments and
|
||
|
// E2E, which is handled in the build process by never providing the SEGMENT_WRITE_KEY
|
||
|
// which process.env.IN_TEST is true
|
||
|
export const segment = process.env.SEGMENT_WRITE_KEY
|
||
|
? new Analytics(process.env.SEGMENT_WRITE_KEY, { flushAt })
|
||
|
: segmentNoop
|
||
|
|
||
|
export const METAMETRICS_ANONYMOUS_ID = '0x0000000000000000'
|