From 8fad712273b54239603daa63d95b72a626e9072a Mon Sep 17 00:00:00 2001 From: xxibcill Date: Mon, 24 Apr 2023 17:10:43 +0700 Subject: [PATCH 1/4] add @vuepress/plugin-google-analytics --- docs/.vuepress/config.js | 3 +++ package.json | 1 + yarn.lock | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 22b944a..a4cbc84 100755 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -13,6 +13,9 @@ module.exports = { { delimiters: 'dollars', }, + googleAnalyticsPlugin({ + id: 'G-DCFFR6X15E', + }), ], ], base: process.env.VUEPRESS_BASE || '/', diff --git a/package.json b/package.json index 224397d..615ba38 100755 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@volar/vue-language-plugin-pug": "^1.0.24", "@vue/runtime-dom": "^3.2.45", "@vuepress/plugin-back-to-top": "^1.3.1", + "@vuepress/plugin-google-analytics": "^1.9.9", "@vuepress/plugin-medium-zoom": "^1.3.1", "@vuepress/plugin-search": "^1.5.2", "vuepress": "^1.9.8" diff --git a/yarn.lock b/yarn.lock index cde55b3..227b244 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1573,6 +1573,13 @@ resolved "https://registry.yarnpkg.com/@vuepress/plugin-google-analytics/-/plugin-google-analytics-1.5.4.tgz#43dff0a84b18b21ea597f3d97281c40d754a5083" integrity sha512-JVmIPBqKNiOVvow+XAZE+jgGvIRMBVxZOpKb5HBQ0xwz/E81Opl7cxdX9VkPKX+i9VoRBPWEiD/874RivzbW1g== +"@vuepress/plugin-google-analytics@^1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/plugin-google-analytics/-/plugin-google-analytics-1.9.9.tgz#78805e7d9a376667adff3ddd0986badfeb2a480f" + integrity sha512-GxrM4BopPqTiGAq2ku5HqInha6uQZePxdGpU8etTbM6hhaxZAev4HehrtHISAJm5dVptbFFJl3sNGQBnw2deFQ== + dependencies: + "@vuepress/types" "1.9.9" + "@vuepress/plugin-last-updated@1.5.4": version "1.5.4" resolved "https://registry.npmjs.org/@vuepress/plugin-last-updated/-/plugin-last-updated-1.5.4.tgz#6f3f9fe720ce7f883c37ddc71ac02fe8f36bbfe4" @@ -1712,6 +1719,15 @@ "@types/webpack-dev-server" "^3" webpack-chain "^6.0.0" +"@vuepress/types@1.9.9": + version "1.9.9" + resolved "https://registry.yarnpkg.com/@vuepress/types/-/types-1.9.9.tgz#7c21e4c91c13e58e2ff303ded9ad7425805cb07d" + integrity sha512-ukGW49ILzLhIc7CltHMr+BeIjWKloJNN1mrvbDz3beycp9b9kgH+DXNdRIK9QCKr4fJsy7x08vNMwZr9Nq/PTQ== + dependencies: + "@types/markdown-it" "^10.0.0" + "@types/webpack-dev-server" "^3" + webpack-chain "^6.0.0" + "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964" From 43cbf75d73240fadf703184c88b9eb49d559a3b2 Mon Sep 17 00:00:00 2001 From: xxibcill Date: Mon, 24 Apr 2023 17:21:01 +0700 Subject: [PATCH 2/4] fix --- docs/.vuepress/config.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index a4cbc84..df7cc98 100755 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -13,9 +13,10 @@ module.exports = { { delimiters: 'dollars', }, - googleAnalyticsPlugin({ - id: 'G-DCFFR6X15E', - }), + '@vuepress/google-analytics', + { + ga: 'G-DCFFR6X15E', + }, ], ], base: process.env.VUEPRESS_BASE || '/', From e3558649bbe1cc94d5ef66aaa84ed8617265ced1 Mon Sep 17 00:00:00 2001 From: xxibcill Date: Mon, 24 Apr 2023 18:08:00 +0700 Subject: [PATCH 3/4] add gtag.js --- docs/.vuepress/config.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index df7cc98..0adbd70 100755 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -13,11 +13,29 @@ module.exports = { { delimiters: 'dollars', }, + ], + [ '@vuepress/google-analytics', { - ga: 'G-DCFFR6X15E', + ga: process.env.GA_MEASUREMENT_ID, + }, + ], + ], + head: [ + [ + 'script', + { + async: true, + src: `https://www.googletagmanager.com/gtag/js?id=${process.env.GA_MEASUREMENT_ID}`, }, ], + [ + 'script', + {}, + [ + `window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', ${process.env.GA_MEASUREMENT_ID});`, + ], + ], ], base: process.env.VUEPRESS_BASE || '/', themeConfig: { From e114d921f5b4212d8dd998a4d4015961e55106a4 Mon Sep 17 00:00:00 2001 From: xxibcill Date: Mon, 24 Apr 2023 18:41:54 +0700 Subject: [PATCH 4/4] remove @vuepress/plugin-google-analytics --- docs/.vuepress/config.js | 6 ------ package.json | 1 - yarn.lock | 16 ---------------- 3 files changed, 23 deletions(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 0adbd70..0260bf7 100755 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -14,12 +14,6 @@ module.exports = { delimiters: 'dollars', }, ], - [ - '@vuepress/google-analytics', - { - ga: process.env.GA_MEASUREMENT_ID, - }, - ], ], head: [ [ diff --git a/package.json b/package.json index 615ba38..224397d 100755 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "@volar/vue-language-plugin-pug": "^1.0.24", "@vue/runtime-dom": "^3.2.45", "@vuepress/plugin-back-to-top": "^1.3.1", - "@vuepress/plugin-google-analytics": "^1.9.9", "@vuepress/plugin-medium-zoom": "^1.3.1", "@vuepress/plugin-search": "^1.5.2", "vuepress": "^1.9.8" diff --git a/yarn.lock b/yarn.lock index 227b244..cde55b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1573,13 +1573,6 @@ resolved "https://registry.yarnpkg.com/@vuepress/plugin-google-analytics/-/plugin-google-analytics-1.5.4.tgz#43dff0a84b18b21ea597f3d97281c40d754a5083" integrity sha512-JVmIPBqKNiOVvow+XAZE+jgGvIRMBVxZOpKb5HBQ0xwz/E81Opl7cxdX9VkPKX+i9VoRBPWEiD/874RivzbW1g== -"@vuepress/plugin-google-analytics@^1.9.9": - version "1.9.9" - resolved "https://registry.yarnpkg.com/@vuepress/plugin-google-analytics/-/plugin-google-analytics-1.9.9.tgz#78805e7d9a376667adff3ddd0986badfeb2a480f" - integrity sha512-GxrM4BopPqTiGAq2ku5HqInha6uQZePxdGpU8etTbM6hhaxZAev4HehrtHISAJm5dVptbFFJl3sNGQBnw2deFQ== - dependencies: - "@vuepress/types" "1.9.9" - "@vuepress/plugin-last-updated@1.5.4": version "1.5.4" resolved "https://registry.npmjs.org/@vuepress/plugin-last-updated/-/plugin-last-updated-1.5.4.tgz#6f3f9fe720ce7f883c37ddc71ac02fe8f36bbfe4" @@ -1719,15 +1712,6 @@ "@types/webpack-dev-server" "^3" webpack-chain "^6.0.0" -"@vuepress/types@1.9.9": - version "1.9.9" - resolved "https://registry.yarnpkg.com/@vuepress/types/-/types-1.9.9.tgz#7c21e4c91c13e58e2ff303ded9ad7425805cb07d" - integrity sha512-ukGW49ILzLhIc7CltHMr+BeIjWKloJNN1mrvbDz3beycp9b9kgH+DXNdRIK9QCKr4fJsy7x08vNMwZr9Nq/PTQ== - dependencies: - "@types/markdown-it" "^10.0.0" - "@types/webpack-dev-server" "^3" - webpack-chain "^6.0.0" - "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"