Skip to content
Snippets Groups Projects
Commit bcd25184 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

Refactor tracking and remove double tracking on language change

parent df4fdca6
No related branches found
No related tags found
No related merge requests found
...@@ -265,12 +265,6 @@ export default { ...@@ -265,12 +265,6 @@ export default {
} }
}) })
.then(() => { .then(() => {
self.$plausible.trackEvent('dropdown selection', {
props: {
query: event.q,
match: event.match
}
})
self.waiting_for_articles = false self.waiting_for_articles = false
history.replaceState({ history.replaceState({
article: self.article, article: self.article,
...@@ -284,18 +278,22 @@ export default { ...@@ -284,18 +278,22 @@ export default {
this.article = null this.article = null
this.$router.push(`/${this.lang}/search/${event.q}`) this.$router.push(`/${this.lang}/search/${event.q}`)
navigate_to_search(this, event.q) navigate_to_search(this, event.q)
this.$plausible.trackEvent('dropdown selection', { event.match = '<fritekstsøk>'
props: {
query: event.q,
match: '<fritekstsøk>'
}
})
} }
// Tracking
console.log(event.update_lang ? "language" : 'dropdown selection')
this.$plausible.trackEvent(event.update_lang ? "language" : 'dropdown selection', {
props: {
query: event.q,
match: event.match
}
})
}, },
update_lang_form: function (event) { update_lang_form: function (event) {
this.lang = event this.lang = event
if (this.event && !this.article) { if (this.event && !this.article) {
this.event.articles = null this.event.articles = null
this.event.update_lang = true
this.select_result(this.event) this.select_result(this.event)
} }
}, },
...@@ -363,11 +361,6 @@ export default { ...@@ -363,11 +361,6 @@ export default {
self.waiting_for_articles = false self.waiting_for_articles = false
}) })
}, },
watch: {
$route() {
this.$plausible.trackEvent('language', {props: {code: this.$route.params.lang}})
}
},
created: function() { created: function() {
let self = this let self = this
window.onpopstate = function (event) { window.onpopstate = function (event) {
......
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