加入客服插件

This commit is contained in:
frankkeres 2025-04-16 19:09:05 +08:00
parent df25a19c8e
commit 49dcbf5e95
4 changed files with 66 additions and 3 deletions

View File

@ -4,6 +4,22 @@ export default {
// Global page headers: https://go.nuxtjs.dev/config-head // Global page headers: https://go.nuxtjs.dev/config-head
head: { head: {
title: 'buddysCloud', title: 'buddysCloud',
script: [
{
src: 'https://www.googletagmanager.com/gtag/js?id=G-PMXV6BN06E',
async: true,
},
{
innerHTML: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-PMXV6BN06E');
`,
type: 'text/javascript',
},
],
__dangerouslyDisableSanitizers: ['script'], // 允许内联脚本
htmlAttrs: { htmlAttrs: {
lang: 'en' lang: 'en'
}, },
@ -44,15 +60,26 @@ export default {
'bootstrap-vue/nuxt', 'bootstrap-vue/nuxt',
'@nuxt/content', '@nuxt/content',
'@nuxtjs/axios', '@nuxtjs/axios',
'@nuxtjs/gtm', // '@nuxtjs/google-analytics'
'@nuxtjs/gtm'
], ],
// buildModules:[
// '@nuxtjs/google-analytics'
// ],
gtm: { gtm: {
id: 'G-PMXV6BN06E', id: 'GTM-PL75JP66',
layer: 'dataLayer', layer: 'dataLayer',
pageTracking: true, // 自动发送页面事件 pageTracking: false, // ✅ 关闭 GTM 的自动页面跟踪,避免和 GA 冲突
enabled: true enabled: true
// enabled: process.env.NODE_ENV === 'production' // enabled: process.env.NODE_ENV === 'production'
}, },
// googleAnalytics: {
// id: 'G-PMXV6BN06E',
// debug: true,
// autoTracking: {
// screenview: true, // GA 自己管理页面跟踪
// },
// },
// Build Configuration: https://go.nuxtjs.dev/config-build // Build Configuration: https://go.nuxtjs.dev/config-build
build: { build: {
} }

21
package-lock.json generated
View File

@ -20,6 +20,9 @@
"vue": "^2.7.10", "vue": "^2.7.10",
"vue-server-renderer": "^2.7.10", "vue-server-renderer": "^2.7.10",
"vue-template-compiler": "^2.7.10" "vue-template-compiler": "^2.7.10"
},
"devDependencies": {
"@nuxtjs/google-analytics": "^2.4.0"
} }
}, },
"node_modules/@ampproject/remapping": { "node_modules/@ampproject/remapping": {
@ -3842,6 +3845,16 @@
"integrity": "sha512-EPS1carKg+dkEVy3qNTqIdp2qV7mUP08nIsupfwQpz++slCVRw7qbQyWvSTig+kFPwz2XXp5/kIIkH+CwrJKkQ==", "integrity": "sha512-EPS1carKg+dkEVy3qNTqIdp2qV7mUP08nIsupfwQpz++slCVRw7qbQyWvSTig+kFPwz2XXp5/kIIkH+CwrJKkQ==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@nuxtjs/google-analytics": {
"version": "2.4.0",
"resolved": "https://registry.npmmirror.com/@nuxtjs/google-analytics/-/google-analytics-2.4.0.tgz",
"integrity": "sha512-rDQTwHIjyjVrx8GywHPuWykJ3jRFGaHl5Iqji/y8tQWUc0yGEeHxOoR0yimzxnTS1Ph2/PubQYpgnVeEPEdL/A==",
"dev": true,
"license": "MIT",
"dependencies": {
"vue-analytics": "^5.22.1"
}
},
"node_modules/@nuxtjs/gtm": { "node_modules/@nuxtjs/gtm": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmmirror.com/@nuxtjs/gtm/-/gtm-2.4.0.tgz", "resolved": "https://registry.npmmirror.com/@nuxtjs/gtm/-/gtm-2.4.0.tgz",
@ -17798,6 +17811,14 @@
"csstype": "^3.1.0" "csstype": "^3.1.0"
} }
}, },
"node_modules/vue-analytics": {
"version": "5.22.1",
"resolved": "https://registry.npmmirror.com/vue-analytics/-/vue-analytics-5.22.1.tgz",
"integrity": "sha512-HPKQMN7gfcUqS5SxoO0VxqLRRSPkG1H1FqglsHccz6BatBatNtm/Vyy8brApktZxNCfnAkrSVDpxg3/FNDeOgQ==",
"deprecated": "Sorry but vue-analytics is no longer maintained. I would suggest you switch to vue-gtag, with love, the guy who made the package.",
"dev": true,
"license": "MIT"
},
"node_modules/vue-client-only": { "node_modules/vue-client-only": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmmirror.com/vue-client-only/-/vue-client-only-2.1.0.tgz", "resolved": "https://registry.npmmirror.com/vue-client-only/-/vue-client-only-2.1.0.tgz",

View File

@ -21,5 +21,8 @@
"vue": "^2.7.10", "vue": "^2.7.10",
"vue-server-renderer": "^2.7.10", "vue-server-renderer": "^2.7.10",
"vue-template-compiler": "^2.7.10" "vue-template-compiler": "^2.7.10"
},
"devDependencies": {
"@nuxtjs/google-analytics": "^2.4.0"
} }
} }

View File

@ -1709,6 +1709,13 @@
consola "^2.15.3" consola "^2.15.3"
defu "^5.0.0" defu "^5.0.0"
"@nuxtjs/google-analytics@^2.4.0":
version "2.4.0"
resolved "https://registry.npmmirror.com/@nuxtjs/google-analytics/-/google-analytics-2.4.0.tgz"
integrity sha512-rDQTwHIjyjVrx8GywHPuWykJ3jRFGaHl5Iqji/y8tQWUc0yGEeHxOoR0yimzxnTS1Ph2/PubQYpgnVeEPEdL/A==
dependencies:
vue-analytics "^5.22.1"
"@nuxtjs/gtm@^2.4.0": "@nuxtjs/gtm@^2.4.0":
version "2.4.0" version "2.4.0"
resolved "https://registry.npmmirror.com/@nuxtjs/gtm/-/gtm-2.4.0.tgz" resolved "https://registry.npmmirror.com/@nuxtjs/gtm/-/gtm-2.4.0.tgz"
@ -9819,6 +9826,11 @@ vm-browserify@^1.0.1:
resolved "https://registry.npmmirror.com/vm-browserify/-/vm-browserify-1.1.2.tgz" resolved "https://registry.npmmirror.com/vm-browserify/-/vm-browserify-1.1.2.tgz"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
vue-analytics@^5.22.1:
version "5.22.1"
resolved "https://registry.npmmirror.com/vue-analytics/-/vue-analytics-5.22.1.tgz"
integrity sha512-HPKQMN7gfcUqS5SxoO0VxqLRRSPkG1H1FqglsHccz6BatBatNtm/Vyy8brApktZxNCfnAkrSVDpxg3/FNDeOgQ==
vue-client-only@^2.1.0: vue-client-only@^2.1.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.npmmirror.com/vue-client-only/-/vue-client-only-2.1.0.tgz" resolved "https://registry.npmmirror.com/vue-client-only/-/vue-client-only-2.1.0.tgz"