From 85099a96642dd5a9e501af6804ea21d112b77002 Mon Sep 17 00:00:00 2001 From: xyf-mac Date: Sun, 14 Nov 2021 18:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=BB=9F=E8=AE=A1=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/package.json | 1 + source/src/background.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/source/package.json b/source/package.json index a8d4a54..b3e7f3c 100644 --- a/source/package.json +++ b/source/package.json @@ -15,6 +15,7 @@ "less": "^4.1.1", "less-loader": "^7.3.0", "lodash": "^4.17.21", + "universal-analytics": "^0.4.23", "uuid": "^8.3.2", "vue": "^2.6.11", "vue-class-component": "^7.2.3", diff --git a/source/src/background.ts b/source/src/background.ts index b0107b4..51eb639 100644 --- a/source/src/background.ts +++ b/source/src/background.ts @@ -1,5 +1,13 @@ import {Msg, Page, PluginEvent} from "@/core/types"; +// @ts-ignore +import * as UA from "universal-analytics" +import {v4} from "uuid" + +// 统计服务 +const userID = localStorage.getItem("userID") || v4() +UA("UA-134924925-3", userID); + console.log("on background") class PortMan {