Add Google Analytics

This commit is contained in:
2021-09-12 11:24:13 +01:00
parent 7eb9070014
commit bcb8511b7e
15 changed files with 127 additions and 36 deletions

View File

@@ -298,6 +298,16 @@ export default withRouter(class Progress extends React.Component {
loading: false,
canProceed: true,
};
if (data.correct) {
this.props.logEvent("correct_answer", {
progress_id: this.props.match.params.progressId,
});
} else {
this.props.logEvent("incorrect_answer", {
progress_id: this.props.match.params.progressId,
});
}
if (data.correct && !data.moreAnswers && this.state.incorrectAnswers[data.currentVocabId]) {
// all answers to question given correctly
@@ -322,6 +332,10 @@ export default withRouter(class Progress extends React.Component {
// test done
newState.duration = data.duration;
this.props.logEvent("test_complete", {
progress_id: this.props.match.params.progressId,
});
promises.push(this.state.db.collection("progress")
.where("uid", "==", this.state.user.uid)
.where("setIds", "==", this.state.setIds)