From 01fd6e6f6b4d83b47db174da527b8c58531fa0e7 Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Wed, 4 Jan 2023 15:16:45 +0100 Subject: [PATCH] [website] geth-website migration (#26412) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add Matomo analytics (#199) * chore: update .env.local.example * chore: update netlify.toml * chore: matomo setup * Fix broken rpc link (#203) Co-authored-by: Nicolás Quiroz Co-authored-by: Sam Richards --- .env.local.example | 4 ++++ docs/getting-started/consensus-clients.md | 2 +- netlify.toml | 5 +++++ package.json | 1 + src/constants.ts | 4 ++++ src/pages/_app.tsx | 9 +++++++++ yarn.lock | 5 +++++ 7 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.env.local.example b/.env.local.example index 951809844f..1066da5452 100644 --- a/.env.local.example +++ b/.env.local.example @@ -6,3 +6,7 @@ NEXT_PUBLIC_ALGOLIA_BASE_SEARCH_INDEX_NAME= # GitHub API # check fine-grained tokens https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#about-personal-access-tokens GITHUB_TOKEN_READ_ONLY= + +# Matomo +NEXT_PUBLIC_MATOMO_URL= +NEXT_PUBLIC_MATOMO_SITE_ID= diff --git a/docs/getting-started/consensus-clients.md b/docs/getting-started/consensus-clients.md index fba7b9c716..499342af5d 100644 --- a/docs/getting-started/consensus-clients.md +++ b/docs/getting-started/consensus-clients.md @@ -55,7 +55,7 @@ Please see the pages on [syncing](/docs/fundamentals/sync-modes) for more detail ## Using Geth {#using-geth} -Geth is the portal for users to send transactions to Ethereum. The Geth Javascript console is available for this purpose, and the majority of the [JSON-RPC API](/docs/rpc) will remain available via web3js or HTTP requests with commands as json payloads. These options are explained in more detail on the [Javascript Console page](/docs/interacting-with-geth/javascript-console). The Javascript console can be started +Geth is the portal for users to send transactions to Ethereum. The Geth Javascript console is available for this purpose, and the majority of the [JSON-RPC API](/docs/interacting-with-geth/rpc) will remain available via web3js or HTTP requests with commands as json payloads. These options are explained in more detail on the [Javascript Console page](/docs/interacting-with-geth/javascript-console). The Javascript console can be started using the following command in a separate terminal (assuming Geth's IPC file is saved in `datadir`): ```sh diff --git a/netlify.toml b/netlify.toml index 25601165c3..7f489b62b7 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,3 +2,8 @@ [functions] included_files = ["src/**"] + +[[headers]] + for = "/*" + [headers.values] + Access-Control-Allow-Origin = "https://matomo.ethereum.org" diff --git a/package.json b/package.json index 50a327440b..5c479d10b0 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@docsearch/react": "3", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", + "@socialgouv/matomo-next": "^1.4.0", "algoliasearch": "^4.14.2", "chakra-ui-markdown-renderer": "^4.1.0", "fast-xml-parser": "^4.0.12", diff --git a/src/constants.ts b/src/constants.ts index 9a273ad08a..22c7bd9792 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -19,6 +19,10 @@ export const GETH_TWITTER_URL = 'https://twitter.com/go_ethereum'; export const GETH_DISCORD_URL = 'https://discord.com/invite/nthXNEv'; export const GO_URL = 'https://go.dev/'; +// analytics +export const DO_NOT_TRACK_URL = + 'http://matomo.ethereum.org/piwik/index.php?module=CoreAdminHome&action=optOut'; + // Downloads export const DEFAULT_BUILD_AMOUNT_TO_SHOW = 12; export const DOWNLOAD_HEADER_BUTTONS: { diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index d83e55da59..0f7b7529ce 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,5 +1,7 @@ import { ChakraProvider } from '@chakra-ui/react'; import { AppProps } from 'next/app'; +import { useEffect } from 'react'; +import { init } from '@socialgouv/matomo-next'; import { Layout } from '../components/layouts'; @@ -10,6 +12,13 @@ import theme from '../theme'; import '../theme/search.css'; export default function App({ Component, pageProps }: AppProps) { + useEffect(() => { + init({ + url: process.env.NEXT_PUBLIC_MATOMO_URL!, + siteId: process.env.NEXT_PUBLIC_MATOMO_SITE_ID! + }); + }, []); + return ( diff --git a/yarn.lock b/yarn.lock index 289aac8a34..10feb1f452 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1274,6 +1274,11 @@ resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.1.4.tgz" integrity sha512-LwzQKA4vzIct1zNZzBmRKI9QuNpLgTQMEjsQLf3BXuGYb3QPTP4Yjf6mkdX+X1mYttZ808QpOwAzZjv28kq7DA== +"@socialgouv/matomo-next@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@socialgouv/matomo-next/-/matomo-next-1.4.0.tgz#9c428b542671542686b56f4ebdca1aa0896af628" + integrity sha512-S+kNX7dwo/cL0VE7GWY8Gnf3t7aeXD4CzallRz9IEttjHJDJI2S8xOrcyaGimYpInr3nDNo+WqeYrafKUdsn1g== + "@swc/helpers@0.4.11": version "0.4.11" resolved "https://registry.npmjs.org/@swc/helpers/-/helpers-0.4.11.tgz"