Skip to content
Snippets Groups Projects
Commit 6f7bbb81 authored by Ole Voldsæter's avatar Ole Voldsæter
Browse files

gjeninnfører plausible-tracking av klikk på artikkelreferanser

parent 3261a60e
No related branches found
No related tags found
No related merge requests found
...@@ -77,7 +77,7 @@ window.onpopstate = function (event) { ...@@ -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) axios.get(api_endpoint + '/' + self.$route.params.lang + '/article/' + self.$route.params.id)
.then(function(response){ .then(function(response){
self.article = response.data self.article = response.data
...@@ -100,6 +100,9 @@ function navigate_to_article(self) { ...@@ -100,6 +100,9 @@ function navigate_to_article(self) {
.then(function(response){ .then(function(response){
self.waiting_for_articles = false self.waiting_for_articles = false
history.replaceState({article: self.article, search_results: [], lang: self.lang}, '') 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 { ...@@ -196,7 +199,7 @@ export default {
}else{ }else{
this.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}} this.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}}
this.waiting_for_articles = true this.waiting_for_articles = true
navigate_to_article(this) navigate_to_article(this, item.source)
} }
} }
}, },
......
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
computed: { computed: {
unparsed: function(){ unparsed: function(){
let lang = this.dictionary let lang = this.dictionary
let path_lemma = this.$route.params.lemma let path = this.$route.fullPath
return this.body.items.map( return this.body.items.map(
function(item){ function(item){
if (item.type_ == 'usage') return {type: item.type_, html: item.text, tag: 'mark'} if (item.type_ == 'usage') return {type: item.type_, html: item.text, tag: 'mark'}
...@@ -38,7 +38,8 @@ export default { ...@@ -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 : ''), ref: '/' + lang + '/' + item.article_id + '/' + (item.word_form || item.lemmas[0].lemma) + (item.definition_id ? '#def' + item.definition_id : ''),
article_id: item.article_id, article_id: item.article_id,
definition_id: item.definition_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_ == 'pronunciation') return {type: item.type_, html: item.string}
else if (item.type_ == 'superscript') return {type: item.type_, html: item.text, tag: 'sup'} else if (item.type_ == 'superscript') return {type: item.type_, html: item.text, tag: 'sup'}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment