Feature: add baidu tongji for analytics

This commit is contained in:
PiEgg
2021-04-05 17:47:06 +08:00
parent 3fd6e4e4c8
commit f53639153e
8 changed files with 113 additions and 1 deletions
+9
View File
@@ -0,0 +1,9 @@
const isDevelopment = process.env.NODE_ENV !== 'production'
/* eslint-disable camelcase */
export const handleBaiduTongJiEvent = (data: IBaiduTongJiOptions) => {
const { category, action, opt_label = '', opt_value = Date.now() } = data
window._hmt.push(['_trackEvent', category, action, opt_label, opt_value])
if (isDevelopment) {
console.log('baidu tongji', data)
}
}