Fire matomoTrackEvents not in then but before

This commit is contained in:
Daniel Egger 2023-04-05 12:18:44 +02:00
parent 0c5f2dc522
commit b27e13fa12
5 changed files with 91 additions and 92 deletions

View File

@ -214,9 +214,8 @@ export default {
}, },
}, },
}, },
}).then(() => {
matomoTrackEvent('Auftrag', 'Ergebnis mit Lehrperson geteilt', this.assignment.id);
}); });
matomoTrackEvent('Auftrag', 'Ergebnis mit Lehrperson geteilt', this.assignment.id);
}, },
reopen() { reopen() {
this.$apollo.mutate({ this.$apollo.mutate({
@ -265,8 +264,8 @@ export default {
}) })
.then(() => { .then(() => {
this.spellcheckLoading = false; this.spellcheckLoading = false;
matomoTrackEvent('Auftrag', 'Rechtschreibung geprüft', this.assignment.id);
}); });
matomoTrackEvent('Auftrag', 'Rechtschreibung geprüft', this.assignment.id);
}, },
}, },

View File

@ -135,7 +135,8 @@ export default {
title: 'Snapshot löschen', title: 'Snapshot löschen',
}) })
.then(() => { .then(() => {
this.$apollo.mutate({ this.$apollo
.mutate({
mutation: DELETE_SNAPSHOT_MUTATION, mutation: DELETE_SNAPSHOT_MUTATION,
variables: { variables: {
input: { input: {
@ -177,7 +178,8 @@ export default {
}); });
} }
}, },
}).then(() => { })
.then(() => {
matomoTrackEvent('Modul Snapshot', 'Snapshot gelöscht', this.$route.params.slug); matomoTrackEvent('Modul Snapshot', 'Snapshot gelöscht', this.$route.params.slug);
}); });
}) })
@ -215,13 +217,14 @@ export default {
}, },
}); });
}, },
}).then(() => {
if (this.snapshot.shared) {
matomoTrackEvent('Modul Snapshot', 'Snapshot mit Team geteilt', this.$route.params.slug);
} else {
matomoTrackEvent('Modul Snapshot', 'Snapshot nicht mehr geteilt', this.$route.params.slug);
}
}); });
const slug = this.$route.params.slug;
if (this.snapshot.shared) {
matomoTrackEvent('Modul Snapshot', 'Snapshot mit Team geteilt', slug);
} else {
matomoTrackEvent('Modul Snapshot', 'Snapshot nicht mehr geteilt', slug);
}
}, },
}, },
}; };

View File

@ -111,8 +111,7 @@ export default {
createSnapshot: { snapshot }, createSnapshot: { snapshot },
}, },
}) => { }) => {
log.debug('snapshot created', snapshot) log.debug('snapshot created', snapshot);
matomoTrackEvent('Modul Snapshot', 'Snapshot erstellt', this.$route.params.slug);
this.showPopover = false; this.showPopover = false;
this.$modal.open('snapshot-created', { this.$modal.open('snapshot-created', {
@ -120,6 +119,7 @@ export default {
}); });
} }
); );
matomoTrackEvent('Modul Snapshot', 'Snapshot erstellt', this.$route.params.slug);
}, },
}, },
}; };

View File

@ -77,9 +77,9 @@ export default {
this.$apollo.mutate({ this.$apollo.mutate({
mutation, mutation,
variables, variables,
}).then(() => {
matomoTrackModuleVisibilityEvent(this.type, this.block, hidden);
}); });
matomoTrackModuleVisibilityEvent(this.type, this.block, hidden);
}, },
}, },
}; };

View File

@ -174,8 +174,7 @@ export default {
data: JSON.stringify(data), data: JSON.stringify(data),
}; };
this.$apollo this.$apollo.mutate({
.mutate({
mutation: UPDATE_ANSWER, mutation: UPDATE_ANSWER,
variables: { variables: {
input: { input: {
@ -204,15 +203,13 @@ export default {
store.writeQuery({ query, variables, data: newData }); store.writeQuery({ query, variables, data: newData });
} }
}, },
}) });
.then(() => {
if (exit) { if (exit) {
matomoTrackEvent('Übung', 'Übung erfolgreich abgeschlossen', this.id) matomoTrackEvent('Übung', 'Übung erfolgreich abgeschlossen', this.id);
this.$router.go(-1); this.$router.go(-1);
} else { } else {
matomoTrackEvent('Übung', 'Übungsschritt abgeschlossen', this.id) matomoTrackEvent('Übung', 'Übungsschritt abgeschlossen', this.id);
} }
});
}; };
survey.onComplete.add((sender, options) => { survey.onComplete.add((sender, options) => {