From 32030a1086439282ca8369f149765ac3b3dfadeb Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 1 Dec 2024 09:48:09 +0800 Subject: [PATCH 1/6] [feature] remove google analytics --- web-app/src/index.html | 8 -------- 1 file changed, 8 deletions(-) diff --git a/web-app/src/index.html b/web-app/src/index.html index 69ac68bc072..d48c89af797 100644 --- a/web-app/src/index.html +++ b/web-app/src/index.html @@ -7,14 +7,6 @@ - - - From 6b49ea2bfbd8d68b58e50ab1db0638d36b3f6fcf Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 1 Dec 2024 10:07:31 +0800 Subject: [PATCH 2/6] [feature] add matomo --- web-app/src/index.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/web-app/src/index.html b/web-app/src/index.html index d48c89af797..ceb5c3d8c6c 100644 --- a/web-app/src/index.html +++ b/web-app/src/index.html @@ -7,6 +7,22 @@ + + + + From 9f01fc6ff58b9dc5d317ab902a920985bce6110e Mon Sep 17 00:00:00 2001 From: liuhy Date: Sun, 1 Dec 2024 10:46:29 +0800 Subject: [PATCH 3/6] [feature] add matomo --- home/docusaurus.config.js | 1 + home/src/pages/components/Matomo.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 home/src/pages/components/Matomo.js diff --git a/home/docusaurus.config.js b/home/docusaurus.config.js index 048b0ce55ac..16b944b3a1d 100644 --- a/home/docusaurus.config.js +++ b/home/docusaurus.config.js @@ -22,6 +22,7 @@ module.exports = { repoUrl, cdnUrl, }, + clientModules: [path.resolve(__dirname, './src/pages/components/Matomo.js')], i18n: { defaultLocale: 'en', locales: ['zh-cn', 'en'], diff --git a/home/src/pages/components/Matomo.js b/home/src/pages/components/Matomo.js new file mode 100644 index 00000000000..2e0721d39c8 --- /dev/null +++ b/home/src/pages/components/Matomo.js @@ -0,0 +1,18 @@ +import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; + +if (ExecutionEnvironment.canUseDOM) { + /* Matomo */ + console.log('Matomo is enabled'); + var _paq = window._paq = window._paq || []; + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u="https://analytics.apache.org/"; + _paq.push(['setTrackerUrl', u+'matomo.php']); + _paq.push(['setSiteId', '25']); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); + })(); + /* End Matomo Code */ +} \ No newline at end of file From 618e2ac1193c2b2c9fc9d02023f3e2247d5c503f Mon Sep 17 00:00:00 2001 From: liuhy Date: Sat, 14 Dec 2024 14:30:16 +0800 Subject: [PATCH 4/6] fix build error --- home/src/pages/components/Matomo.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/home/src/pages/components/Matomo.js b/home/src/pages/components/Matomo.js index 2e0721d39c8..bc9e764fb17 100644 --- a/home/src/pages/components/Matomo.js +++ b/home/src/pages/components/Matomo.js @@ -15,4 +15,8 @@ if (ExecutionEnvironment.canUseDOM) { g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); /* End Matomo Code */ +} + +export default function Matomo() { + return this; } \ No newline at end of file From 89068487a9fa99a0b37a3c6e9e6ab44189ba099a Mon Sep 17 00:00:00 2001 From: liuhy Date: Fri, 3 Jan 2025 18:23:44 +0800 Subject: [PATCH 5/6] [type:feature] modify to matomo plugin --- home/docusaurus.config.js | 8 +++++++- home/package.json | 5 +++-- home/src/pages/components/Matomo.js | 22 ---------------------- 3 files changed, 10 insertions(+), 25 deletions(-) delete mode 100644 home/src/pages/components/Matomo.js diff --git a/home/docusaurus.config.js b/home/docusaurus.config.js index 80e273d47d3..73f2657ea2b 100644 --- a/home/docusaurus.config.js +++ b/home/docusaurus.config.js @@ -22,12 +22,17 @@ module.exports = { repoUrl, cdnUrl, }, - clientModules: [path.resolve(__dirname, './src/pages/components/Matomo.js')], i18n: { defaultLocale: 'en', locales: ['zh-cn', 'en'], }, themeConfig: { + matomo: { + matomoUrl: 'https://analytics.apache.org/', + siteId: 'ID', + phpLoader: 'matomo.php', + jsLoader: 'matomo.js', + }, image: '/img/hertzbeat-logo.svg', liveCodeBlock: { playgroundPosition: 'bottom', @@ -345,6 +350,7 @@ module.exports = { fromExtensions: ['html'], }, ], + 'docusaurus-plugin-matomo', '@docusaurus/plugin-ideal-image', [ '@docusaurus/plugin-pwa', diff --git a/home/package.json b/home/package.json index e503487cca5..ddf065f8459 100644 --- a/home/package.json +++ b/home/package.json @@ -32,7 +32,9 @@ "aos": "^2.3.4", "clsx": "1.2.1", "color": "3.2.1", + "docusaurus-plugin-matomo": "^0.0.8", "file-loader": "6.2.0", + "markdownlint-cli2": "^0.13.0", "react": "17.0.2", "react-dom": "17.0.2", "react-slick": "0.29.0", @@ -41,8 +43,7 @@ "swiper": "7.4.1", "url-loader": "4.1.1", "workbox-routing": "6.5.3", - "workbox-strategies": "6.5.3", - "markdownlint-cli2": "^0.13.0" + "workbox-strategies": "6.5.3" }, "browserslist": { "production": [ diff --git a/home/src/pages/components/Matomo.js b/home/src/pages/components/Matomo.js deleted file mode 100644 index bc9e764fb17..00000000000 --- a/home/src/pages/components/Matomo.js +++ /dev/null @@ -1,22 +0,0 @@ -import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment'; - -if (ExecutionEnvironment.canUseDOM) { - /* Matomo */ - console.log('Matomo is enabled'); - var _paq = window._paq = window._paq || []; - /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); - (function() { - var u="https://analytics.apache.org/"; - _paq.push(['setTrackerUrl', u+'matomo.php']); - _paq.push(['setSiteId', '25']); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); - })(); - /* End Matomo Code */ -} - -export default function Matomo() { - return this; -} \ No newline at end of file From 61603d188b51f1607e5bec86ce91f4bc8bb5a969 Mon Sep 17 00:00:00 2001 From: liuhy Date: Thu, 9 Jan 2025 10:32:05 +0800 Subject: [PATCH 6/6] [type:feature] modify to matomo plugin --- home/docusaurus.config.js | 2 +- web-app/src/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/home/docusaurus.config.js b/home/docusaurus.config.js index 73f2657ea2b..1d1a8f84074 100644 --- a/home/docusaurus.config.js +++ b/home/docusaurus.config.js @@ -29,7 +29,7 @@ module.exports = { themeConfig: { matomo: { matomoUrl: 'https://analytics.apache.org/', - siteId: 'ID', + siteId: '67', phpLoader: 'matomo.php', jsLoader: 'matomo.js', }, diff --git a/web-app/src/index.html b/web-app/src/index.html index ceb5c3d8c6c..1905675a2ab 100644 --- a/web-app/src/index.html +++ b/web-app/src/index.html @@ -16,7 +16,7 @@ (function() { var u="https://analytics.apache.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); - _paq.push(['setSiteId', '25']); + _paq.push(['setSiteId', '67']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })();