| 32 | * promise should _never_ be overwritten as other external components can depend on it. |
| 33 | */ |
| 34 | export default class BaseTracker { |
| 35 | constructor () { |
| 36 | this.initializing = false |
| 37 | this.initialized = false |
| 38 | |
| 39 | this.setupInitialization() |
| 40 | |
| 41 | this.loggingEnabled = false |
| 42 | try { |
| 43 | this.loggingEnabled = (new URLSearchParams(window.location.search)).has(TRACKER_LOGGING_ENABLED_QUERY_PARAM) |
| 44 | } catch (e) {} |
| 45 | |
| 46 | this.trackerInitTimeout = DEFAULT_TRACKER_INIT_TIMEOUT |
| 47 | } |
| 48 | |
| 49 | async identify (traits = {}) {} |
| 50 | |
| 51 | async resetIdentity () {} |
| 52 | |
| 53 | async trackPageView () {} |
| 54 | |
| 55 | async trackEvent (action, properties = {}) {} |
| 56 | |
| 57 | async trackTiming (duration, category, variable, label) {} |
| 58 | |
| 59 | watchForDisableAllTrackingChanges (store) { |
| 60 | this.disableAllTracking = store.getters['tracker/disableAllTracking'] |
| 61 | |
| 62 | store.watch( |
| 63 | (state, getters) => getters['tracker/disableAllTracking'], |
| 64 | (result) => { this.disableAllTracking = result } |
| 65 | ) |
| 66 | } |
| 67 | |
| 68 | get isInitialized () { |
| 69 | return this.initialized |
| 70 | } |
| 71 | |
| 72 | set isInitialized (initialized) { |
| 73 | this.initialized = initialized |
| 74 | } |
| 75 | |
| 76 | get isInitializing () { |
| 77 | return this.initializing |
| 78 | } |
| 79 | |
| 80 | set isInitializing (initializing) { |
| 81 | this.initializing = initializing |
| 82 | } |
| 83 | |
| 84 | get initializationComplete () { |
| 85 | return this.initializationCompletePromise |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Standard initialization method to be used to initialize the tracker. Ensures that the |
| 90 | * initialize process is only called once and returns the initializationComplete promise. |
| 91 | * |
nothing calls this directly
no outgoing calls
no test coverage detected