From 1da2e9b58075578b669f79cb3c8921a947ef7d72 Mon Sep 17 00:00:00 2001 From: ehab-hassan Date: Tue, 28 Jan 2025 16:15:29 +0200 Subject: [PATCH 1/2] update matomo link --- docusaurus.config.ts | 121 +++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 74 deletions(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 7b150d6..975e02b 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -48,15 +48,32 @@ const config: Config = { themes: ['@docusaurus/theme-mermaid'], scripts: [ - { - src: - '/js/crisp.js', + src: '/js/crisp.js', // Keep this for Crisp script async: false, }, ], themeConfig: { + injectHtmlTags: { + headTags: [ + { + tagName: 'script', + innerHTML: ` + var _paq = window._paq || []; + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u="//analytics.threefold.io/"; + _paq.push(['setTrackerUrl', u+'matomo.php']); + _paq.push(['setSiteId', '20']); + 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); + })(); + `, + }, + ], + }, algolia: { appId: 'ARAM4VJG2D', @@ -70,12 +87,14 @@ const config: Config = { respectPrefersColorScheme: false, }, image: 'img/tf_graph.png', - metadata: [ - { name: 'description', content: 'ThreeFold is laying the foundation for Web4, the next generation of the Internet.' }, - { property: 'og:image', content: 'https://docs.threefold.io/img/tf_graph.png' }, - { property: 'og:description', content: 'ThreeFold is laying the foundation for Web4, the next generation of the Internet.' }, - { property: 'og:title', content: 'Introduction | ThreeFold Docs' }, - ], + + metadata: [ + { name: 'description', content: 'ThreeFold is laying the foundation for Web4, the next generation of the Internet.' }, + { property: 'og:image', content: 'https://docs.threefold.io/img/tf_graph.png' }, + { property: 'og:description', content: 'ThreeFold is laying the foundation for Web4, the next generation of the Internet.' }, + { property: 'og:title', content: 'Introduction | ThreeFold Docs' }, + ], + navbar: { title: '', logo: { @@ -102,96 +121,50 @@ const config: Config = { }, ], }, + footer: { style: 'dark', links: [ { title: 'Docs', items: [ - { - label: 'Introduction', - to: '/docs/introduction', - }, - { - label: 'Litepaper', - to: '/docs/litepaper', - }, - { - label: 'Roadmap', - to: '/docs/roadmap', - }, - { - label: 'Manual', - href: 'https://manual.grid.tf/', - }, + { label: 'Introduction', to: '/docs/introduction' }, + { label: 'Litepaper', to: '/docs/litepaper' }, + { label: 'Roadmap', to: '/docs/roadmap' }, + { label: 'Manual', href: 'https://manual.grid.tf/' }, ], }, { title: 'Features', items: [ - { - label: 'Become a Farmer', - to: '/docs/category/become-a-farmer', - }, - { - label: 'Components', - to: '/docs/category/components', - }, - { - label: 'Technology', - to: '/docs/tech', - }, - { - label: 'Tokenomics', - to: '/docs/tokens/tokenomics', - }, + { label: 'Become a Farmer', to: '/docs/category/become-a-farmer' }, + { label: 'Components', to: '/docs/category/components' }, + { label: 'Technology', to: '/docs/tech' }, + { label: 'Tokenomics', to: '/docs/tokens/tokenomics' }, ], }, { title: 'Community', items: [ - { - label: 'Telegram', - href: 'https://t.me/threefold', - }, - { - label: 'X', - href: 'https://x.com/threefold_io', - }, - { - label: 'Forum', - href: 'https://forum.threefold.io', - }, - { - label: 'Support', - to: '/support', - }, + { label: 'Telegram', href: 'https://t.me/threefold' }, + { label: 'X', href: 'https://x.com/threefold_io' }, + { label: 'Forum', href: 'https://forum.threefold.io' }, + { label: 'Support', to: '/support' }, ], }, { title: 'Links', items: [ - { - label: 'ThreeFold.io', - href: 'https://threefold.io', - }, - { - label: 'Dashboard', - href: 'https://dashboard.grid.tf', - }, - { - label: 'GitHub', - href: 'https://github.com/threefoldtech/home', - }, - { - label: 'Gitea', - href: 'https://git.ourworld.tf', - }, + { label: 'ThreeFold.io', href: 'https://threefold.io' }, + { label: 'Dashboard', href: 'https://dashboard.grid.tf' }, + { label: 'GitHub', href: 'https://github.com/threefoldtech/home' }, + { label: 'Gitea', href: 'https://git.ourworld.tf' }, ], }, ], copyright: `Copyright © ${new Date().getFullYear()} ThreeFold`, }, + prism: { theme: prismThemes.github, darkTheme: prismThemes.dracula, @@ -199,4 +172,4 @@ const config: Config = { } satisfies Preset.ThemeConfig, }; -export default config; \ No newline at end of file +export default config; -- 2.40.1 From 5ef80ad1dfb49dec585fe4857a8d66ebb0c31132 Mon Sep 17 00:00:00 2001 From: ehab-hassan Date: Tue, 28 Jan 2025 17:57:02 +0200 Subject: [PATCH 2/2] add Matomo script --- docusaurus.config.ts | 126 +++++++++++++++++++++++++++---------------- static/js/matomo.js | 29 ++++++++++ 2 files changed, 108 insertions(+), 47 deletions(-) create mode 100644 static/js/matomo.js diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 975e02b..5abdc3f 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -48,32 +48,20 @@ const config: Config = { themes: ['@docusaurus/theme-mermaid'], scripts: [ + { - src: '/js/crisp.js', // Keep this for Crisp script + src: + '/js/crisp.js', async: false, }, + { + src: + '/js/matomo.js', + async: true, + }, ], themeConfig: { - injectHtmlTags: { - headTags: [ - { - tagName: 'script', - innerHTML: ` - var _paq = window._paq || []; - _paq.push(['trackPageView']); - _paq.push(['enableLinkTracking']); - (function() { - var u="//analytics.threefold.io/"; - _paq.push(['setTrackerUrl', u+'matomo.php']); - _paq.push(['setSiteId', '20']); - 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); - })(); - `, - }, - ], - }, algolia: { appId: 'ARAM4VJG2D', @@ -87,14 +75,12 @@ const config: Config = { respectPrefersColorScheme: false, }, image: 'img/tf_graph.png', - - metadata: [ - { name: 'description', content: 'ThreeFold is laying the foundation for Web4, the next generation of the Internet.' }, - { property: 'og:image', content: 'https://docs.threefold.io/img/tf_graph.png' }, - { property: 'og:description', content: 'ThreeFold is laying the foundation for Web4, the next generation of the Internet.' }, - { property: 'og:title', content: 'Introduction | ThreeFold Docs' }, - ], - + metadata: [ + { name: 'description', content: 'ThreeFold is laying the foundation for Web4, the next generation of the Internet.' }, + { property: 'og:image', content: 'https://docs.threefold.io/img/tf_graph.png' }, + { property: 'og:description', content: 'ThreeFold is laying the foundation for Web4, the next generation of the Internet.' }, + { property: 'og:title', content: 'Introduction | ThreeFold Docs' }, + ], navbar: { title: '', logo: { @@ -121,50 +107,96 @@ const config: Config = { }, ], }, - footer: { style: 'dark', links: [ { title: 'Docs', items: [ - { label: 'Introduction', to: '/docs/introduction' }, - { label: 'Litepaper', to: '/docs/litepaper' }, - { label: 'Roadmap', to: '/docs/roadmap' }, - { label: 'Manual', href: 'https://manual.grid.tf/' }, + { + label: 'Introduction', + to: '/docs/introduction', + }, + { + label: 'Litepaper', + to: '/docs/litepaper', + }, + { + label: 'Roadmap', + to: '/docs/roadmap', + }, + { + label: 'Manual', + href: 'https://manual.grid.tf/', + }, ], }, { title: 'Features', items: [ - { label: 'Become a Farmer', to: '/docs/category/become-a-farmer' }, - { label: 'Components', to: '/docs/category/components' }, - { label: 'Technology', to: '/docs/tech' }, - { label: 'Tokenomics', to: '/docs/tokens/tokenomics' }, + { + label: 'Become a Farmer', + to: '/docs/category/become-a-farmer', + }, + { + label: 'Components', + to: '/docs/category/components', + }, + { + label: 'Technology', + to: '/docs/tech', + }, + { + label: 'Tokenomics', + to: '/docs/tokens/tokenomics', + }, ], }, { title: 'Community', items: [ - { label: 'Telegram', href: 'https://t.me/threefold' }, - { label: 'X', href: 'https://x.com/threefold_io' }, - { label: 'Forum', href: 'https://forum.threefold.io' }, - { label: 'Support', to: '/support' }, + { + label: 'Telegram', + href: 'https://t.me/threefold', + }, + { + label: 'X', + href: 'https://x.com/threefold_io', + }, + { + label: 'Forum', + href: 'https://forum.threefold.io', + }, + { + label: 'Support', + to: '/support', + }, ], }, { title: 'Links', items: [ - { label: 'ThreeFold.io', href: 'https://threefold.io' }, - { label: 'Dashboard', href: 'https://dashboard.grid.tf' }, - { label: 'GitHub', href: 'https://github.com/threefoldtech/home' }, - { label: 'Gitea', href: 'https://git.ourworld.tf' }, + { + label: 'ThreeFold.io', + href: 'https://threefold.io', + }, + { + label: 'Dashboard', + href: 'https://dashboard.grid.tf', + }, + { + label: 'GitHub', + href: 'https://github.com/threefoldtech/home', + }, + { + label: 'Gitea', + href: 'https://git.ourworld.tf', + }, ], }, ], copyright: `Copyright © ${new Date().getFullYear()} ThreeFold`, }, - prism: { theme: prismThemes.github, darkTheme: prismThemes.dracula, @@ -172,4 +204,4 @@ const config: Config = { } satisfies Preset.ThemeConfig, }; -export default config; +export default config; \ No newline at end of file diff --git a/static/js/matomo.js b/static/js/matomo.js new file mode 100644 index 0000000..eab1a23 --- /dev/null +++ b/static/js/matomo.js @@ -0,0 +1,29 @@ +/* Matomo Tag Manager */ + + var _mtm = window._mtm = window._mtm || []; + _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); + (function() { + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; + g.async=true; g.src='https://analytics.threefold.io/js/container_47J8h6pI.js'; s.parentNode.insertBefore(g,s); + })(); + +/* End Matomo Tag Manager */ + + + + +/* Matomo */ + + var _paq = window._paq = window._paq || []; + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u="//analytics.threefold.io/"; + _paq.push(['setTrackerUrl', u+'matomo.php']); + _paq.push(['setSiteId', '20']); + 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 */ -- 2.40.1