if-wolftrack-html-plugin
v1.0.3
Published
埋点程序辅助插件
Downloads
2
Maintainers
Readme
Why
Help to auto-inject if-wolftrack
script into rendered html before the head tag depends on the env-mode.
Options
import InsertWolfTrackPlugin from 'if-wolftrack-html-plugin'
InsertWolfTrackPlugin(options)
| key | type | default | |
| --------- | --------- | ----------------------------- | ------------------------------------------------------------ |
| FILE_NAME | String
| index.html
| 注入的目标HTML |
| APP_ID | String
| Default
| 应用ID |
| APP_TYPE | String
| 4
| 应用类型,默认4 (H5) |
| AUTP_PV | Boolean
| true
| 是否自动发送PV |
| SPA | Boolean
| false
| 是否支持单页应用检查 |
| TRACK_URL | Object
| {production: '//localhost'}
| where_to_sendpv 环境配置 development
,test
,uat
,production
|
How to Use
webpack
const InsertWolfTrackPlugin = require('if-wolftrack-html-plugin/webpack')
// Vue.config.js
configureWebpack: {
plugins: [
new InsertWolfTrackPlugin({
APP_ID: 'myAppID',
TRACK_URL: {
development: '//dev.mysite.com/track_log',
test: '//test.mysite.com/track_log',
production: '//prod.mysite.com/track_log'
}
})
]
}
Rollup
import InsertWolfPTrack from 'if-wolftrack-html-plugin/rollup'
// vite.config.js
plugins: [
InsertWolfPTrack({
APP_ID: 'myAppID',
TRACK_URL: {
development: '//dev.mysite.com/track_log',
test: '//test.mysite.com/track_log',
production: '//prod.mysite.com/track_log'
}
})
]