Skip to content

Commit ae0d083

Browse files
feat(resources): add event tracking
1 parent 246fba6 commit ae0d083

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

src/pages/[locale]/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,13 @@ const HomePage = ({
371371
href="/resources/"
372372
isSecondary
373373
variant="outline"
374+
onClick={() =>
375+
trackCustomEvent({
376+
eventCategory,
377+
eventAction: "ethereum_activity",
378+
eventName: "ethereum_activity",
379+
})
380+
}
374381
>
375382
{t("page-index:page-index-activity-action")} <ChevronNext />
376383
</ButtonLink>

src/pages/[locale]/resources.tsx

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { cn } from "@/lib/utils/cn"
2121
import { dataLoader } from "@/lib/utils/data/dataLoader"
2222
import { existsNamespace } from "@/lib/utils/existsNamespace"
2323
import { getLastDeployDate } from "@/lib/utils/getLastDeployDate"
24+
import { trackCustomEvent } from "@/lib/utils/matomo"
2425
import { getLocaleTimestamp } from "@/lib/utils/time"
2526
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"
2627

@@ -37,6 +38,8 @@ import loadNamespaces from "@/i18n/loadNamespaces"
3738
import { fetchGrowThePie } from "@/lib/api/fetchGrowThePie"
3839
import heroImg from "@/public/images/heroes/guides-hub-hero.jpg"
3940

41+
const EVENT_CATEGORY = "dashboard"
42+
4043
// In seconds
4144
const REVALIDATE_TIME = BASE_TIME_UNIT * 1
4245

@@ -104,6 +107,13 @@ const ResourcesPage = ({ txCostsMedianUsd }) => {
104107
GITHUB_REPO_URL
105108
).toString()}
106109
className="visited:text-white"
110+
onClick={() => {
111+
trackCustomEvent({
112+
eventCategory: EVENT_CATEGORY,
113+
eventAction: "links",
114+
eventName: "Ethereum.org Github Page Feedback",
115+
})
116+
}}
107117
>
108118
{t("page-resources-share-feedback")}
109119
</Link>
@@ -131,6 +141,14 @@ const ResourcesPage = ({ txCostsMedianUsd }) => {
131141
"relative text-nowrap rounded-xl px-4 py-2 text-sm [&_svg]:shrink-0 [&_svg]:text-sm",
132142
activeSection === key && "!text-primary"
133143
)}
144+
onClick={() =>
145+
trackCustomEvent({
146+
eventCategory: EVENT_CATEGORY,
147+
eventAction: "whats_on_this_page",
148+
eventName:
149+
"network,using, scaling, resilience, privacy_security",
150+
})
151+
}
134152
>
135153
{activeSection === key && (
136154
<motion.div
@@ -188,7 +206,17 @@ const ResourcesPage = ({ txCostsMedianUsd }) => {
188206
<div className="text-center font-bold">
189207
<Translation id="page-resources:page-resources-find-more" />
190208
</div>
191-
<ButtonLink href="https://ethereumdashboards.com" size="lg">
209+
<ButtonLink
210+
href="https://ethereumdashboards.com"
211+
size="lg"
212+
onClick={() => {
213+
trackCustomEvent({
214+
eventCategory: EVENT_CATEGORY,
215+
eventAction: "links",
216+
eventName: "ethereumdashboards.com",
217+
})
218+
}}
219+
>
192220
ethereumdashboards.com
193221
</ButtonLink>
194222
</VStack>
@@ -214,6 +242,13 @@ const ResourcesPage = ({ txCostsMedianUsd }) => {
214242
).toString()}
215243
variant="outline"
216244
isSecondary
245+
onClick={() => {
246+
trackCustomEvent({
247+
eventCategory: EVENT_CATEGORY,
248+
eventAction: "links",
249+
eventName: "Ethereum.org Github Feature Request",
250+
})
251+
}}
217252
>
218253
{t("page-resources-suggest-resource")}
219254
</ButtonLink>
@@ -224,6 +259,13 @@ const ResourcesPage = ({ txCostsMedianUsd }) => {
224259
).toString()}
225260
variant="outline"
226261
isSecondary
262+
onClick={() => {
263+
trackCustomEvent({
264+
eventCategory: EVENT_CATEGORY,
265+
eventAction: "links",
266+
eventName: "Ethereum.org Github Bug Report",
267+
})
268+
}}
227269
>
228270
<FaGithub /> {t("page-resources-found-bug")}
229271
</ButtonLink>

0 commit comments

Comments
 (0)