📈 Mise à jour du tracking

pull/191/head
Laurent Bossavit 2018-04-28 19:11:00 +02:00
parent 5470bea048
commit a624510c64
1 changed files with 22 additions and 1 deletions

View File

@ -48,6 +48,11 @@ export default (tracker, flatRules, answerSource) => (state, action) => {
)
if (action.type === 'USER_INPUT_UPDATE') {
tracker.push([
'trackEvent',
'input:' + state.activeTargetInput,
answerSource(state)(state.activeTargetInput)
])
return { ...state, analysis, situationGate: situationWithDefaults(state) }
}
@ -73,6 +78,22 @@ export default (tracker, flatRules, answerSource) => (state, action) => {
: state.foldedSteps
}
if (action.type === 'SET_ACTIVE_TARGET_INPUT') {
tracker.push([
'trackEvent',
'select',
state.activeTargetInput
])
}
if (action.type === 'START_CONVERSATION') {
tracker.push([
'trackEvent',
'refine',
''
])
}
// Les nextSteps initiaux ne dépendent que des règles et pourraient être précalculés
// TODO: sortir ce calcul du state pour éviter cette "astuce" avec stillBlank
if (['START_CONVERSATION', 'SET_ACTIVE_TARGET_INPUT'].includes(action.type)) {
@ -99,7 +120,7 @@ export default (tracker, flatRules, answerSource) => (state, action) => {
tracker.push([
'trackEvent',
'done',
'after' + length(newState.foldedSteps) + 'questions'
'after ' + length(newState.foldedSteps) + ' questions'
])
}
let foldedSteps = [...state.foldedSteps, state.currentQuestion]