diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9da4f7f..af1a162 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,7 +15,7 @@ As this project is a user-facing application, the places in the semantic version
### Added
-- Track some events to Matomo (run/abort annotation) [#166](https://github.com/spraakbanken/mink-frontend/issues/166)
+- Track some events to Matomo [#166](https://github.com/spraakbanken/mink-frontend/issues/166)
### Fixed
diff --git a/src/corpus/analysis/AnalysisPanel.vue b/src/corpus/analysis/AnalysisPanel.vue
index df562ff..45ded7e 100644
--- a/src/corpus/analysis/AnalysisPanel.vue
+++ b/src/corpus/analysis/AnalysisPanel.vue
@@ -6,7 +6,6 @@ import useExports from "../exports/exports.composable";
import useJob from "../job/job.composable";
import ActionButton from "@/components/ActionButton.vue";
import PendingContent from "@/spin/PendingContent.vue";
-import { useMatomo } from "@/matomo";
const corpusId = useCorpusIdParam();
const { runJob, jobState, isJobRunning } = useJob(corpusId);
@@ -14,7 +13,6 @@ const { canBeReady } = useCorpusState(corpusId);
const { exports, loadExports, downloadResult, getDownloadFilename } =
useExports(corpusId);
const { isDone } = useCorpusState(corpusId);
-const matomo = useMatomo();
const isPending = ref(false);
const canRun = computed(
@@ -25,7 +23,6 @@ loadExports();
async function doRunJob() {
isPending.value = true;
- matomo?.trackEvent("Corpus", "Run annotation", corpusId);
await runJob();
isPending.value = false;
}
diff --git a/src/corpus/exports/exports.composable.ts b/src/corpus/exports/exports.composable.ts
index e7e5da6..8aad440 100644
--- a/src/corpus/exports/exports.composable.ts
+++ b/src/corpus/exports/exports.composable.ts
@@ -1,11 +1,16 @@
import { computed } from "vue";
import { downloadFile } from "@/util";
+import { useMatomo } from "@/matomo";
import useMinkBackend from "@/api/backend.composable";
import { useResourceStore } from "@/store/resource.store";
import useMessenger from "@/message/messenger.composable";
export default function useExports(corpusId: string) {
const resourceStore = useResourceStore();
+ const mink = useMinkBackend();
+ const { alertError } = useMessenger();
+ const matomo = useMatomo();
+
const corpus = computed(() => resourceStore.corpora[corpusId]);
/** Exports sorted alphabetically by path, but "stats_*" first. */
const exports = computed(() =>
@@ -14,8 +19,6 @@ export default function useExports(corpusId: string) {
?.sort((a, b) => a.path.localeCompare(b.path))
.sort((a, b) => b.path.indexOf("stats_") - a.path.indexOf("stats_")),
);
- const mink = useMinkBackend();
- const { alertError } = useMessenger();
async function loadExports() {
const exports = await mink.loadExports(corpusId).catch(alertError);
@@ -23,6 +26,7 @@ export default function useExports(corpusId: string) {
}
async function downloadResult() {
+ matomo?.trackEvent("Corpus result", "Download export archive", corpusId);
const data = await mink.downloadExports(corpusId).catch(alertError);
if (!data) return;
downloadFile(data, getDownloadFilename());
@@ -33,11 +37,12 @@ export default function useExports(corpusId: string) {
}
async function downloadResultFile(path: string) {
+ const filename = path.split("/").pop()!;
+ matomo?.trackEvent("Corpus result", "Download export file", filename);
const data = await mink
.downloadExportFiles(corpusId, path)
.catch(alertError);
if (!data) return;
- const filename = path.split("/").pop()!;
downloadFile(data, filename);
}
diff --git a/src/corpus/job/JobStatus.vue b/src/corpus/job/JobStatus.vue
index 65a28f8..64c75a9 100644
--- a/src/corpus/job/JobStatus.vue
+++ b/src/corpus/job/JobStatus.vue
@@ -1,6 +1,5 @@
@@ -45,7 +38,7 @@ async function doAbortJob() {
{{ $t("job.abort") }}
diff --git a/src/corpus/job/job.composable.ts b/src/corpus/job/job.composable.ts
index caf1de7..dd2bcc7 100644
--- a/src/corpus/job/job.composable.ts
+++ b/src/corpus/job/job.composable.ts
@@ -4,6 +4,7 @@ import useMinkBackend from "@/api/backend.composable";
import { useResourceStore } from "@/store/resource.store";
import useMessenger from "@/message/messenger.composable";
import type { JobType } from "@/api/api.types";
+import { useMatomo } from "@/matomo";
// Module-scope ticker, can be watched to perform task intermittently
const pollTick = useInterval(2000);
@@ -16,6 +17,7 @@ export default function useJob(corpusId: string) {
const corpus = computed(() => resourceStore.corpora[corpusId]);
const mink = useMinkBackend();
const { alertError } = useMessenger();
+ const matomo = useMatomo();
async function loadJob() {
const info = await mink.resourceInfoOne(corpusId).catch(alertError);
@@ -24,23 +26,27 @@ export default function useJob(corpusId: string) {
}
async function runJob() {
+ matomo?.trackEvent("Corpus", "Run annotation", corpusId);
const info = await mink.runJob(corpusId).catch(alertError);
corpus.value.status = info.job;
}
async function installKorp() {
+ matomo?.trackEvent("Tool", "Install corpus in Korp", corpusId);
const info = await mink.installKorp(corpusId).catch(alertError);
if (!info) return;
corpus.value.status = info.job;
}
async function installStrix() {
+ matomo?.trackEvent("Tool", "Install corpus in Strix", corpusId);
const info = await mink.installStrix(corpusId).catch(alertError);
if (!info) return;
corpus.value.status = info.job;
}
async function abortJob() {
+ matomo?.trackEvent("Corpus", "Abort annotation", corpusId);
await mink.abortJob(corpusId).catch(alertError);
await loadJob();
}