You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

21 lines
429 B

const got = require('got')
const { TRACKING_GA, NOW_URL } = process.env
// Send stats to google analytics
module.exports = (category, action, label, value) => {
if (!TRACKING_GA) return
got.get('https://www.google-analytics.com/collect', {
query: {
v: '1',
tid: TRACKING_GA,
cid: NOW_URL || '000',
t: 'event',
ec: category,
ea: action,
el: label,
ev: value
}
})
}