feat(analytics): integrate Umami analytics
This commit introduces Umami analytics for website usage tracking. - Adds a new `analytics.js` file to the `public` directory to load the Umami tracking script. - Updates `nuxt.config.ts` to inject this script into the document head and configure the page title. Additionally, this commit fixes the referrer note display by removing a hardcoded prefix.
This commit is contained in:
@@ -21,7 +21,7 @@ export const _useEventOrder = () => {
|
||||
|
||||
const refererNote = computed(() => {
|
||||
const key = refererKey.value as keyof typeof REFERRER_MAP;
|
||||
return key in REFERRER_MAP ? `推薦單位:${REFERRER_MAP[key]}` : "";
|
||||
return key in REFERRER_MAP ? REFERRER_MAP[key] : "";
|
||||
});
|
||||
|
||||
function formatLocalDate(date: Date): string {
|
||||
|
||||
@@ -4,4 +4,16 @@ export default defineNuxtConfig({
|
||||
devtools: { enabled: true },
|
||||
modules: ["@nuxt/ui"],
|
||||
css: ["~/assets/css/main.css"],
|
||||
app: {
|
||||
head: {
|
||||
titleTemplate: "%s | Tootaio Studio",
|
||||
title: "报价单",
|
||||
script: [
|
||||
{
|
||||
src: "/analytics.js",
|
||||
tagPosition: "head",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
10
public/analytics.js
Normal file
10
public/analytics.js
Normal file
@@ -0,0 +1,10 @@
|
||||
(function () {
|
||||
const UMAMI_SCRIPT_JS = "https://umami.tootaio.com/script.js";
|
||||
const UMAMI_ID = "dcb8b7ff-408c-4843-9a1a-c01da704ffc1";
|
||||
|
||||
var script = document.createElement("script");
|
||||
script.async = true;
|
||||
script.src = UMAMI_SCRIPT_JS;
|
||||
script.setAttribute("data-website-id", UMAMI_ID);
|
||||
document.head.appendChild(script);
|
||||
})();
|
||||
Reference in New Issue
Block a user