MCPcopy Create free account
hub / github.com/codecombat/codecombat / BaseTracker

Class BaseTracker

app/core/Tracker2/BaseTracker.js:34–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 * promise should _never_ be overwritten as other external components can depend on it.
33 */
34export 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 *

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected