import * as Sentry from '@sentry/browser' ; import ReactGA from 'react-ga' ; import { Environment } from '.' ; export const initialize = ( ) => { const { SENTRY_DSN , GOOGLEANALYTICS_KEY } = Environment . config ; if ( ! Environment . isDevelopment ) { Sentry . init ( { dsn : SENTRY_DSN } ) ; ReactGA . initialize ( GOOGLEANALYTICS_KEY ) ; } else { console . warn ( 'Not initializing analytics for development build' ) ; } } ; export type EventCategory = 'UI' ; export enum UI { SHARE_INCIDENT_TWITTER = 'Shared incident via Twitter' , SHARE_INCIDENT_URL = 'Shared incident via URL' , SHOW_PROJECT_INFO = 'Show project info modal' } export const pageview = ( path ) => { ReactGA . pageview ( path ) ; } ; interface EventParams { category : EventCategory ; action : UI ; label ? : string ; nonInteraction ? : boolean ; } export const event = ( { category , action , label , nonInteraction , } ) => { ReactGA . event ( { category , action , label , nonInteraction } ) ; } ;