|
@@ -0,0 +1,27 @@
|
|
|
|
+import Track from 'sunshine-track'
|
|
|
|
+
|
|
|
|
+const options = {
|
|
|
|
+ projectKey: 'test-project', // 项目的key
|
|
|
|
+ userId: 'digger', // 用户id
|
|
|
|
+ report: {
|
|
|
|
+ url: 'http://example.com/report', // 上报url
|
|
|
|
+ reportType: 'img' // 上报方式
|
|
|
|
+ },
|
|
|
|
+ switchs: { // 上报数据开关
|
|
|
|
+ xhr: true, // xhr请求
|
|
|
|
+ fetch: true, // fetch请求
|
|
|
|
+ error: true, // 报错
|
|
|
|
+ hashchange: true, // hash变化
|
|
|
|
+ history: true, // history变化
|
|
|
|
+ whitescreen: true, // 白屏
|
|
|
|
+ performance: true // 页面性能
|
|
|
|
+ },
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// Vue
|
|
|
|
+export const track = async (app) => {
|
|
|
|
+ app.use(Track, options)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// // React、Angular
|
|
|
|
+// Track.init(options)
|