Modrinth/middleware/analytics.js
Redblueflame 12d86493bf
Switch ads provider, and switch the analytics system to Ariadne (#214)
* Switch ads provider, and switch the analytics system to Ariadne

* Fix CI error

* Remove debug messages and errors

* Updated nuxtjs
2021-05-18 07:48:26 -07:00

21 lines
460 B
JavaScript

import axios from 'axios'
export default async function (context) {
let domain = ''
if (process.server) {
domain = context.req.headers.host
} else {
domain = location.host
}
const url = context.$config.analytics.base_url + '/register/visit'
const path = context.route.path.split('?')[0]
try {
return await axios.post(url, {
path,
domain,
consent: false,
})
} catch (e) {
// Simply silence the issue.
}
}