Skip to content

Commit fbce6d8

Browse files
authored
Merge pull request #7176 from ethereum/dev
Deploy v4.9.0
2 parents dbc72a4 + 0bf822a commit fbce6d8

File tree

353 files changed

+31213
-44202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

353 files changed

+31213
-44202
lines changed

.all-contributorsrc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8142,6 +8142,42 @@
81428142
"contributions": [
81438143
"doc"
81448144
]
8145+
},
8146+
{
8147+
"login": "chendatony31",
8148+
"name": "Tony Chen",
8149+
"avatar_url": "https://avatars.githubusercontent.com/u/2173383?v=4",
8150+
"profile": "https://tokenpocket.pro",
8151+
"contributions": [
8152+
"doc"
8153+
]
8154+
},
8155+
{
8156+
"login": "metalc",
8157+
"name": "metalc",
8158+
"avatar_url": "https://avatars.githubusercontent.com/u/102876192?v=4",
8159+
"profile": "https://github.com/metalc",
8160+
"contributions": [
8161+
"doc"
8162+
]
8163+
},
8164+
{
8165+
"login": "Tuongg2312",
8166+
"name": "Tuongg2312",
8167+
"avatar_url": "https://avatars.githubusercontent.com/u/107551539?v=4",
8168+
"profile": "https://github.com/Tuongg2312",
8169+
"contributions": [
8170+
"doc"
8171+
]
8172+
},
8173+
{
8174+
"login": "ErikSaunier",
8175+
"name": "Ξrik Saunier",
8176+
"avatar_url": "https://avatars.githubusercontent.com/u/1122363?v=4",
8177+
"profile": "https://github.com/ErikSaunier",
8178+
"contributions": [
8179+
"doc"
8180+
]
81458181
}
81468182
],
81478183
"contributorsPerLine": 7,

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ In case you want to test them as if you were in a Netlify env, you can install t
158158

159159
> The Proof of Attendance Protocol is a dapp that distributes badges in the form of ERC-721 tokens to prove you participated in an event. [More on POAPs](https://www.poap.xyz/).
160160
161-
### ethereum.org 2021 Contributor POAP
161+
### ethereum.org 2022 Contributor POAP
162162

163-
- If you have committed any changes in 2021 so far that were merged into our repo, you have a POAP waiting!
163+
- If you have committed any changes in 2022 so far that were merged into our repo, you have a POAP waiting!
164164
- This includes our dedicated translators on Crowdin
165165

166166
[![Discord](https://img.shields.io/discord/714888181740339261?color=1C1CE1&label=Claim%20Your%20POAP!%20%7C%20Discord%20%F0%9F%91%8B%20&style=flat)](https://discord.gg/CetY6Y4)
167167

168-
- 👆 To claim your Contributor POAP, join our Discord server and paste a link to your contribution in the #poaps-🏆 channel
168+
- 👆 To claim your Contributor POAP, join our Discord server and paste a link to your contribution in the `#🥇 | poaps` [channel](https://discord.com/channels/714888181740339261/804005643211898911)
169169

170170
- A member of our team will verify the request and DM you with a personalized link to claim your own freshly minted POAP collectible!
171171

@@ -1305,6 +1305,12 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
13051305
<td align="center"><a href="https://github.com/NachoRoizman"><img src="https://avatars.githubusercontent.com/u/107893772?v=4?s=100" width="100px;" alt=""/><br /><sub><b>NachoRoizman</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=NachoRoizman" title="Documentation">📖</a></td>
13061306
<td align="center"><a href="https://linkedin.com/in/miragaya-ivan"><img src="https://avatars.githubusercontent.com/u/72365253?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Iván Miragaya</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=M-Ivan" title="Code">💻</a></td>
13071307
<td align="center"><a href="https://github.com/smejak"><img src="https://avatars.githubusercontent.com/u/20759274?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jakub Smékal</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=smejak" title="Documentation">📖</a></td>
1308+
<td align="center"><a href="https://tokenpocket.pro"><img src="https://avatars.githubusercontent.com/u/2173383?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tony Chen</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=chendatony31" title="Documentation">📖</a></td>
1309+
<td align="center"><a href="https://github.com/metalc"><img src="https://avatars.githubusercontent.com/u/102876192?v=4?s=100" width="100px;" alt=""/><br /><sub><b>metalc</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=metalc" title="Documentation">📖</a></td>
1310+
</tr>
1311+
<tr>
1312+
<td align="center"><a href="https://github.com/Tuongg2312"><img src="https://avatars.githubusercontent.com/u/107551539?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tuongg2312</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=Tuongg2312" title="Documentation">📖</a></td>
1313+
<td align="center"><a href="https://github.com/ErikSaunier"><img src="https://avatars.githubusercontent.com/u/1122363?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ξrik Saunier</b></sub></a><br /><a href="https://github.com/ethereum/ethereum-org-website/commits?author=ErikSaunier" title="Documentation">📖</a></td>
13081314
</tr>
13091315
</table>
13101316

docs/event-tracking.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Event tracking on ethereum.org
2+
3+
This is a guide on how to prepare event tracking when creating a new page or redesigning an existing page.
4+
5+
## What are events?
6+
7+
Events are user interactions on the application that standard pageviews cannot track within a session. We create custom code snippets in the application in order to trigger these events.
8+
9+
Events are useful for measuring user engagement on the website. Tracking events lets us know when users interact with elements and forms and can help us understand how successful users are at accomplishing their goals.
10+
11+
Event tracking is a great way to validate our design decisions and assumptions. We can create reports in Matomo to gather insights and improve our product.
12+
13+
[View the Matomo guide on event tracking](https://matomo.org/guide/reports/event-tracking/).
14+
15+
## How is event tracking implemented?
16+
17+
ethereum.org uses Matomo, an open-source alternative to Google Analytics, allowing us to protect user privacy by not sharing any analytics with third parties.
18+
19+
We implemented Matomo using the [JavaScript tracking client](https://developer.matomo.org/guides/tracking-javascript-guide) via the [`gatsby-matomo-plugin`](https://github.com/kremalicious/gatsby-plugin-matomo) Gatsby plugin.
20+
21+
## What to measure?
22+
23+
Ideally, ask yourself what design decision/assumptions have been made on the page and should/could be validated by measured performance:
24+
25+
- clicks
26+
- downloads
27+
- site searches
28+
- popups viewed/dismissed
29+
- form fields abandoned
30+
- scroll behavior down a page
31+
32+
This data can be later used to decide whether a feature is being used or is underperforming.
33+
34+
It's helpful to ask yourself how the results of what we track and measure might influence our decision-making. For example, measuring something that won't help us make concrete product decisions is probably not worth tracking.
35+
36+
# How to name events?
37+
38+
Broadly, events should be grouped by specific topic (e.g. L2 page external links, selected bridge, selected cex).
39+
40+
## Each event comprises of 4 hierarchical values:
41+
42+
1. Category (other events may share the same category if one feature has several actions)
43+
2. Action
44+
3. Name (optional)
45+
4. Value (optional, can be number or text)
46+
47+
## Category
48+
49+
Please consider the page's visual position when deciding which events should be grouped together (under the same category). Ideally, all events related to one feature should be grouped together under the same category only if there is also a single position on the page where the event can be triggered. If in doubt, always use a different category when a feature gets used in multiple places on the page.
50+
51+
Example:
52+
Find wallets page redirects to external links (wallets) in two positions: A) through the main list of wallets B) Through a modal window with detailed info about a specific wallet. In this case, we would like to have two separate categories for external links instead of one:
53+
54+
- Matomo list view
55+
- Category: WalletExternalLinkList
56+
- Action: Go to wallet
57+
- eventName: WalletName
58+
- Value: position
59+
- Matomo modal view
60+
- Category: WalletExternalLinkModal
61+
- Action: Go to wallet
62+
- eventName: WalletName
63+
- Value: position
64+
65+
Such division allows us to identify where a user clicked on the page precisely; if all external links were under one category, "ExternalLink", we would not be able to measure the performance difference between the list and the modal window.
66+
67+
## Usage
68+
69+
Ethereum.org has a utility function (`trackCustomEvent`) for easily creating Matomo events.
70+
71+
```javascript
72+
import { trackCustomEvent } from "../utils/matomo"
73+
```
74+
75+
The function requires an object of event options. See the example below.
76+
77+
```javascript
78+
const handleEvent = (): void => {
79+
trackCustomEvent({
80+
eventCategory: `FeedbackWidget toggled`,
81+
eventAction: `Clicked`,
82+
eventName: `Opened feedback widget`,
83+
eventValue: `1`,
84+
})
85+
}
86+
```
87+
88+
## Hidden gem of tracking: Value
89+
90+
Can be used to get more info on the UX.
91+
92+
Examples:
93+
94+
- Use it to track the average position of clicked search result
95+
- What terms are entered into the search field
96+
- Which option is chosen from a dropdown menu
97+
- How many or what filters are applied when filtering the list of wallets

gatsby-browser.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
defaultLanguage,
2323
isLang,
2424
} from "./src/utils/languages"
25+
import { IS_DEV } from "./src/utils/env"
2526
import { Context } from "./src/types"
2627

2728
// Default languages included:
@@ -42,7 +43,7 @@ export const wrapPageElement: GatsbyBrowser<
4243

4344
// client side redirect on paths that don't have a locale in them. Most useful
4445
// on dev env where we don't have server redirects
45-
if (!isLang(pathLocale)) {
46+
if (IS_DEV && !isLang(pathLocale)) {
4647
let detected =
4748
window.localStorage.getItem("eth-org-language") ||
4849
browserLang({

gatsby-config.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,19 @@ const config: GatsbyConfig = {
230230
},
231231
},
232232
// Needed for Gatsby Cloud redirect support
233-
`gatsby-plugin-gatsby-cloud`,
233+
{
234+
resolve: `gatsby-plugin-gatsby-cloud`,
235+
options: {
236+
generateMatchPathRewrites: false,
237+
},
238+
},
234239
// Creates `_redirects` & `_headers` build files for Netlify
235-
`gatsby-plugin-netlify`,
240+
{
241+
resolve: `gatsby-plugin-netlify`,
242+
options: {
243+
generateMatchPathRewrites: false,
244+
},
245+
},
236246
],
237247
// https://www.gatsbyjs.com/docs/reference/release-notes/v2.28/#feature-flags-in-gatsby-configjs
238248
flags: {

gatsby-node.ts

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ import redirects from "./redirects.json"
2323

2424
const exec = util.promisify(child_process.exec)
2525

26+
const commonRedirectProps = {
27+
isPermanent: true,
28+
ignoreCase: true,
29+
force: true,
30+
}
31+
2632
/**
2733
* Markdown isOutdated check
2834
* Parse header ids in markdown file (both translated and english) and compare their info structure.
@@ -190,13 +196,11 @@ export const createPages: GatsbyNode<any, Context>["createPages"] = async ({
190196
}) => {
191197
const { createPage, createRedirect } = actions
192198

193-
// server side redirects
199+
// custom redirects defined in `redirects.json`
194200
redirects.forEach((redirect) => {
195201
createRedirect({
202+
...commonRedirectProps,
196203
...redirect,
197-
isPermanent: true,
198-
ignoreCase: true,
199-
force: true,
200204
})
201205
})
202206

@@ -260,6 +264,12 @@ export const createPages: GatsbyNode<any, Context>["createPages"] = async ({
260264
// e.g. English file: "src/content/community/index.md"
261265
// e.g. corresponding German file: "src/content/translations/de/community/index.md"
262266
if (language === defaultLanguage) {
267+
createRedirect({
268+
...commonRedirectProps,
269+
fromPath: slug.slice(3),
270+
toPath: slug,
271+
})
272+
263273
for (const lang of supportedLanguages) {
264274
const splitPath = relativePath.split("/")
265275
splitPath.splice(2, 0, `translations/${lang}`)
@@ -315,6 +325,14 @@ export const createPages: GatsbyNode<any, Context>["createPages"] = async ({
315325
// we can remove this logic and the `/pages-conditional/` directory.
316326
const outdatedMarkdown = [`eth`, `dapps`, `wallets`, `what-is-ethereum`]
317327
outdatedMarkdown.forEach((page) => {
328+
const originalPath = `/${page}/`
329+
330+
createRedirect({
331+
...commonRedirectProps,
332+
fromPath: originalPath,
333+
toPath: `/${defaultLanguage}${originalPath}`,
334+
})
335+
318336
supportedLanguages.forEach(async (lang) => {
319337
const markdownPath = path.resolve(
320338
`src/content/translations/${lang}/${page}/index.md`
@@ -326,7 +344,7 @@ export const createPages: GatsbyNode<any, Context>["createPages"] = async ({
326344
page,
327345
lang
328346
)
329-
const originalPath = `/${page}/`
347+
330348
const slug = `/${lang}${originalPath}`
331349

332350
createPage<Context>({
@@ -356,14 +374,29 @@ export const onCreatePage: GatsbyNode<any, Context>["onCreatePage"] = async ({
356374
page,
357375
actions,
358376
}) => {
359-
const { createPage, deletePage } = actions
377+
const { createPage, deletePage, createRedirect } = actions
360378

361-
// create routes without the lang prefix e.g. `/{path}` as our i18n plugin
362-
// only creates `/{lang}/{path}` routes. This is useful on dev env to avoid
363-
// getting a 404 since we don't have server side redirects
364-
if (IS_DEV && page.path.startsWith(`/${defaultLanguage}`)) {
379+
const isDefaultLang = page.path.startsWith(`/${defaultLanguage}`)
380+
381+
if (isDefaultLang) {
365382
const path = page.path.slice(3)
366-
createPage({ ...page, path })
383+
384+
if (IS_DEV) {
385+
// create routes without the lang prefix e.g. `/{path}` as our i18n plugin
386+
// only creates `/{lang}/{path}` routes. This is useful on dev env to avoid
387+
// getting a 404 since we don't have server side redirects
388+
createPage({ ...page, path })
389+
}
390+
391+
if (!IS_DEV && !path.match(/^\/404(\/|.html)$/)) {
392+
// on prod, indicate our servers to redirect the root paths to the
393+
// `/{defaultLang}/{path}`
394+
createRedirect({
395+
...commonRedirectProps,
396+
fromPath: path,
397+
toPath: page.path,
398+
})
399+
}
367400
}
368401

369402
const isTranslated = page.context.locale !== defaultLanguage
@@ -387,6 +420,20 @@ export const onCreatePage: GatsbyNode<any, Context>["onCreatePage"] = async ({
387420
}
388421
}
389422

423+
export const onPostBootstrap: GatsbyNode["onPostBootstrap"] = ({ actions }) => {
424+
const { createRedirect } = actions
425+
426+
supportedLanguages.forEach((lang) => {
427+
createRedirect({
428+
...commonRedirectProps,
429+
fromPath: `/${lang}/*`,
430+
toPath: `/${lang}/404`,
431+
statusCode: 404,
432+
force: false,
433+
})
434+
})
435+
}
436+
390437
export const createSchemaCustomization: GatsbyNode["createSchemaCustomization"] =
391438
({ actions, schema }) => {
392439
const { createTypes } = actions

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ethereum-org-website",
3-
"version": "4.8.0",
3+
"version": "4.9.0",
44
"description": "Website of ethereum.org",
55
"main": "index.js",
66
"repository": "[email protected]:ethereum/ethereum-org-website.git",
@@ -79,6 +79,7 @@
7979
"@types/node": "^17.0.23",
8080
"@types/react": "^17.0.39",
8181
"@types/react-dom": "^17.0.11",
82+
"@types/react-instantsearch-dom": "^6.12.3",
8283
"@types/styled-components": "^5.1.25",
8384
"@types/styled-system": "^5.1.15",
8485
"babel-preset-gatsby": "^2.14.0",

0 commit comments

Comments
 (0)