feat: update deps and insight

This commit is contained in:
Haoyu Xu
2025-01-28 22:10:02 +08:00
parent 07e7cd2bd1
commit 075087e733
6 changed files with 1264 additions and 1312 deletions

View File

@@ -6,11 +6,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="renderer" content="webkit">
<title>aklive2d</title>
<script
id="counterscale-script"
src="https://insight.halyul.dev/on-demand.js"
defer
></script>
<link rel="canonical" href="https://arknights.halyul.dev/">
</head>
<body>
<div id="app"></div>

View File

@@ -1,4 +1,5 @@
import {createCustomEvent} from "@/components/helper"
import * as Counterscale from "@counterscale/tracker";
import { createCustomEvent } from "@/components/helper"
export default class Insight {
#isInsightInited = false
@@ -12,14 +13,19 @@ export default class Insight {
this.#isInsightInited = true
if (doNotTrack) return
try {
const config = {
path: `/${import.meta.env.VITE_LINK}`
const canonical = document.querySelector('link[rel="canonical"][href]')
if (!canonical) {
return;
}
if (isFromWallpaperEngine) config.hostname = "file://wallpaperengine.local";
window.counterscale = {
q: [["set", "siteId", import.meta.env.VITE_INSIGHT_ID], ["trackPageview", config]],
};
window.counterscaleOnDemandTrack();
if (isFromWallpaperEngine) canonical.href = "file://wallpaperengine.local/";
Counterscale.init({
siteId: "aklive2d",
reporterUrl: "https://insight.halyul.dev/collect",
autoTrackPageviews: false,
});
Counterscale.trackPageview({
url: `/${import.meta.env.VITE_LINK}`
});
} catch (e) {
console.warn && console.warn(e.message)
}