Skip to content

Commit 90f507a

Browse files
authored
feat: remove docusaurus-plugin-matomo and add custom Matomo tracking script (#632)
1 parent 9b5d922 commit 90f507a

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

website/docusaurus.config.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ const config = {
8686
editUrl: `${repoUrl}/edit/${branch}/website/`,
8787
editLocalizedFiles: true,
8888
},
89-
],
90-
'docusaurus-plugin-matomo'
89+
]
9190
],
9291
themeConfig: ({
9392
image: 'img/logo.svg',
@@ -198,16 +197,31 @@ const config = {
198197
theme: prismThemes.github,
199198
darkTheme: prismThemes.oneDark,
200199
additionalLanguages: ['java', 'bash']
201-
},
202-
matomo: {
203-
matomoUrl: 'https://analytics.apache.org/',
204-
siteId: '83',
205-
phpLoader: 'matomo.php',
206-
jsLoader: 'matomo.js',
207200
}
208201
}),
209202
themes: ['@docusaurus/theme-mermaid'],
210-
headTags: [],
203+
headTags: [
204+
{
205+
tagName: 'script',
206+
attributes: {
207+
type: 'text/javascript',
208+
},
209+
innerHTML: `
210+
var _paq = window._paq = window._paq || [];
211+
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
212+
_paq.push(["disableCookies"]);
213+
_paq.push(['trackPageView']);
214+
_paq.push(['enableLinkTracking']);
215+
(function() {
216+
var u="https://analytics.apache.org/";
217+
_paq.push(['setTrackerUrl', u+'matomo.php']);
218+
_paq.push(['setSiteId', '83']);
219+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
220+
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
221+
})();
222+
`,
223+
},
224+
],
211225
markdown: {
212226
format: 'md',
213227
mermaid: true,

website/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"@docusaurus/theme-mermaid": "^3.9.1",
2424
"@mdx-js/react": "^3.0.0",
2525
"clsx": "^2.0.0",
26-
"docusaurus-plugin-matomo": "^0.0.8",
2726
"markdownlint-cli2": "^0.18.1",
2827
"prism-react-renderer": "^2.3.0",
2928
"react": "^19.0.0",

0 commit comments

Comments
 (0)