From c8e57185828c735b89c9335be206f22159766584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no> Date: Fri, 15 Jan 2021 10:39:14 +0100 Subject: [PATCH] =?UTF-8?q?tracker=20klikk=20p=C3=A5=20referanser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index 4695fe2..24f29b5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -75,7 +75,11 @@ window.onpopstate = function (event) { } } -function navigate_to_article(self, article_id) { +function navigate_to_article(self, article_id, origin_article, origin_lemma) { + if (origin_article) { + self.$plausible.trackEvent('internal link incoming', {props: {origin: `${self.$route.params.lang}/${origin_article}/${origin_lemma || '_'}`}}) + } + axios.get(self.api_pref + '' + article_id) .then(function(response){ self.article = response.data @@ -171,9 +175,11 @@ export default { this.article_key++ history.replaceState({article: this.article, search_results: this.search_results, lang: this.lang}, '') }else{ + let current_art_id = this.article.article_id + let current_lemma = this.article.lemmas[0].lemma this.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}} this.waiting_for_articles = true - navigate_to_article(this, item.article_id) + navigate_to_article(this, item.article_id, current_art_id, current_lemma) } }, search_hit_click: function(article){ -- GitLab