ソースを参照

精细化网络统计

Michael Wang 6 年 前
コミット
f329d52c56
1 ファイル変更12 行追加2 行削除
  1. 12 2
      src/plugins/axios.js

+ 12 - 2
src/plugins/axios.js

@@ -128,7 +128,12 @@ _$http.interceptors.request.use(
 // Add a response interceptor
 _$httpWith500Msg.interceptors.response.use(
   response => {
-    window._hmt.push(["_trackEvent", "网络请求-响应", response.config.url]);
+    window._hmt.push([
+      "_trackEvent",
+      `页面-${location.pathname}`,
+      "网络请求-响应",
+      new URL(response.config.url, "http://www.qmth.com.cn").pathname
+    ]);
     return response;
   },
   error => {
@@ -205,7 +210,12 @@ _$httpWith500Msg.interceptors.response.use(
 _$http.interceptors.response.use(
   // no auto 500 error UI
   response => {
-    window._hmt.push(["_trackEvent", "网络请求-响应", response.config.url]);
+    window._hmt.push([
+      "_trackEvent",
+      `页面-${location.pathname}`,
+      "网络请求-响应",
+      new URL(response.config.url, "http://www.qmth.com.cn").pathname
+    ]);
     return response;
   },
   error => {