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

Method _initializeTracker

app/core/Tracker2/index.js:58–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56 }
57
58 async _initializeTracker () {
59 try {
60 const allTrackers = [
61 this.cookieConsentTracker,
62 ...this.trackers
63 ]
64 await allSettled(allTrackers.map(t => t.initialize()))
65 } catch (e) {
66 console.error('Tracker init failed', e)
67 } finally {
68 // We always allow the master tracker to continue because some sub trackers may have initialized correctly
69 this.onInitializeSuccess()
70 }
71
72 let callIdentify = false
73
74 // Check initialize on page load
75 const initializeOnNextPageLoad = window.sessionStorage.getItem(SESSION_STORAGE_IDENTIFY_ON_NEXT_PAGE_LOAD)
76 if (initializeOnNextPageLoad === 'true') {
77 window.sessionStorage.removeItem(SESSION_STORAGE_IDENTIFY_ON_NEXT_PAGE_LOAD)
78 callIdentify = true
79 }
80
81 const identifiedThisSession = window.sessionStorage.getItem(SESSION_STORAGE_IDENTIFIED_AT_SESSION_START_KEY)
82 if (identifiedThisSession !== 'true') {
83 callIdentify = true
84 window.sessionStorage.setItem(SESSION_STORAGE_IDENTIFIED_AT_SESSION_START_KEY, 'true')
85 }
86
87 if (callIdentify) {
88 this.identify()
89 }
90 }
91
92
93 async identify (traits = {}) {

Callers

nothing calls this directly

Calls 4

identifyMethod · 0.95
setItemMethod · 0.80
initializeMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected