export enum EventType { LOAD_FULL_KINGDOM_FROM_URL = "LOAD_FULL_KINGDOM_FROM_URL" , LOAD_PARTIAL_KINGDOM_FROM_URL = "LOAD_PARTIAL_KINGDOM_FROM_URL" , RANDOMIZE_EVENTS_AND_LANDMARKS = "RANDOMIZE_EVENTS_AND_LANDMARKS" , RANDOMIZE_BOONS = "RANDOMIZE_BOONS" , RANDOMIZE_KINGDOM = "RANDOMIZE_KINGDOM" , RANDOMIZE_MULTIPLE = "RANDOMIZE_MULTIPLE" , RANDOMIZE_SINGLE = "RANDOMIZE_SINGLE" } export enum Category { ERROR = "error" , EVENT = "event" } export class EventTracker { static trackEvent ( eventType ) { EventTracker . attemptToSend ( Category . EVENT , eventType ) ; } static trackError ( errorType ) { EventTracker . attemptToSend ( Category . ERROR , errorType ) ; } private static attemptToSend ( category , eventType ) { try { ga ( "send" , "event" , category , eventType ) ; } catch ( e ) { console . log ( `Attempted to send event: ${ category }: ${ eventType }` ) ; } } }