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

rapporterer dropdown-valg til plausible

parent db95f1ce
No related branches found
No related tags found
No related merge requests found
......@@ -135,9 +135,9 @@ export default {
return new Promise(resolve => {
return axios.get(self.api_pref + 'suggest?q=' + q).then(
function(response) {
let hits = q.length ? [{q: q}] : []
let hits = q.length ? [{}] : []
hits = hits.concat(response.data)
resolve(hits)
resolve(hits.map(h => Object.assign(h, {q: q})))
})
})
}
......@@ -154,10 +154,11 @@ export default {
this.$refs.search.value = ''
document.activeElement.blur()
if(event.body){
this.$router.push('/' + event.dictionary + '/' + event.article_id)
this.$router.push('/' + event.dictionary + '/' + event.article_id + '#' + event.match)
this.search_results = []
this.article = event
history.replaceState({article: this.article, search_results: this.search_results, lang: this.lang}, '')
this.$plausible.trackEvent('dropdown selection', {props: {query: event.q, dictionary: event.dictionary, match: event.match}})
}else{
this.waiting_for_articles = true
this.article = {lemmas: [], body:{pronunciation: [], definitions: [], etymology: []}}
......@@ -182,7 +183,6 @@ export default {
}
},
mounted: function(){
console.log(document.referrer)
let self = this
axios.get(api_endpoint + '/bob').then(function(response){
let concepts = response.data.concepts
......
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