前端事件采集
安装
npm install @tdit/web-track
全局配置
import {configure} from '@tdit/web-track'
import { createBrowserHistory } from 'history';
import { matchPath } from 'react-router-dom';
const history = createBrowserHistory();
const routes = [{ path: '/users/:userid' }, { path: '/users' }];
configure({
endpoint: '',
siteId: 'teamwork',
environment: process.env.NODE_ENV,
auto: false, // 是否自动检测url变化,默认为false
autoGa: false, // 使用data-ga属性采集事件
reactRouter: { // 监听react-router, 默认为undefined
history: history,
routes: routes,
matchPath: matchPath
}
})