diff --git a/src/App.vue b/src/App.vue index 0c11d3699fc884c839ad47085ec2aef404c50ff7..809118a34582e1b314b08f49a33206687ead3190 100644 --- a/src/App.vue +++ b/src/App.vue @@ -77,7 +77,7 @@ window.onpopstate = function (event) { } } -function navigate_to_article(self) { +function navigate_to_article(self, source) { axios.get(api_endpoint + '/' + self.$route.params.lang + '/article/' + self.$route.params.id) .then(function(response){ self.article = response.data @@ -100,6 +100,9 @@ function navigate_to_article(self) { .then(function(response){ self.waiting_for_articles = false history.replaceState({article: self.article, search_results: [], lang: self.lang}, '') + if (source) { + self.$plausible.trackEvent('internal link incoming', {props: {origin: source}}) + } }) } @@ -196,7 +199,7 @@ export default { }else{ this.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}} this.waiting_for_articles = true - navigate_to_article(this) + navigate_to_article(this, item.source) } } }, diff --git a/src/components/DefElement.vue b/src/components/DefElement.vue index d1e40f4045d0b3a4ed4b75d39827d372386a644a..a83ed493a675b2449f686cc75462355d3ceb7640 100644 --- a/src/components/DefElement.vue +++ b/src/components/DefElement.vue @@ -27,7 +27,7 @@ export default { computed: { unparsed: function(){ let lang = this.dictionary - let path_lemma = this.$route.params.lemma + let path = this.$route.fullPath return this.body.items.map( function(item){ if (item.type_ == 'usage') return {type: item.type_, html: item.text, tag: 'mark'} @@ -38,7 +38,8 @@ export default { ref: '/' + lang + '/' + item.article_id + '/' + (item.word_form || item.lemmas[0].lemma) + (item.definition_id ? '#def' + item.definition_id : ''), article_id: item.article_id, definition_id: item.definition_id, - definition_order: item.definition_order + definition_order: item.definition_order, + source: path } else if (item.type_ == 'pronunciation') return {type: item.type_, html: item.string} else if (item.type_ == 'superscript') return {type: item.type_, html: item.text, tag: 'sup'}