ga-mp-tracker
v0.0.3
Published
Goolge Analytics 4 tracking for wechat miniprogram
Downloads
2
Maintainers
Readme
在小程序中使用谷歌统计4
1.安装
npm i ga-mp-tracker
2.设置全局实例
import gaTracker from 'ga-mp-tracker'
const { GoogleAnalytics } = gaTracker
const ga = new GoogleAnalytics({
measurement_id: 'xxx',
api_secret: 'xxx'
})
Vue.prototype.$ga = ga
3.发送页面事件
const { Event } = gaTracker
const event = new Event('page_view', {
page_title: '页面标题'
})
this.$ga.send(event)
4.发送自定义事件
const { Event } = gaTracker
const event = new Event('event_name', params)
this.$ga.send(event)