1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 04:45:22 -04:00

move from fathom to vercel analytics

This commit is contained in:
Jake Jarvis 2024-07-31 12:40:05 -04:00
parent fff106ffbb
commit 563533fdb0
8 changed files with 79 additions and 70 deletions

View File

@ -28,8 +28,3 @@ RESEND_DOMAIN=
NEXT_PUBLIC_TURNSTILE_SITE_KEY=
# used only for backend validation of contact form submissions on /api/contact.
TURNSTILE_SECRET_KEY=
# optional. sets the site ID of the fathom analytics script.
# https://app.usefathom.com/sites
# https://usefathom.com/ref/ZEYG0O (referral link)
NEXT_PUBLIC_FATHOM_SITE_ID=

View File

@ -20,7 +20,6 @@ Most production steps are handled [automatically by Vercel](https://vercel.com/d
## 🌎 Related
- [💻 /uses](https://jarv.is/uses/) Things and stuff I use.
- [📈 /stats](https://jarv.is/stats/) My [Fathom Analytics](https://usefathom.com/ref/ZEYG0O) dashboard.
- [🕰️ /previously](https://jarv.is/previously/) An embarrassing trip down this site's memory lane.
- Visit [/y2k](https://jarv.is/y2k/) if you want to experience the _fully_ immersive time machine, but don't say I didn't warn you...
- [🧅 Tor (.onion) mirror](http://jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion/) For an excessive level of privacy and security.

View File

@ -93,12 +93,6 @@ export default (phase, { defaultConfig }) => {
fallback: [],
}),
redirects: async () => [
{
source: "/stats",
destination: `https://app.usefathom.com/share/${process.env.NEXT_PUBLIC_FATHOM_SITE_ID || ""}/${config.siteDomain}`,
permanent: false,
},
// NOTE: don't remove this, it ensures de-AMPing the site hasn't offended our google overlords too badly!
// https://developers.google.com/search/docs/advanced/experience/remove-amp#remove-only-amp
{ source: "/notes/:slug/amp.html", destination: "/notes/:slug/", permanent: true },

View File

@ -29,11 +29,12 @@
"@prisma/client": "^5.17.0",
"@react-spring/web": "^9.7.4",
"@stitches/react": "1.3.1-1",
"@vercel/analytics": "^1.3.1",
"@vercel/speed-insights": "^1.0.12",
"comma-number": "^2.1.0",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.12",
"fast-glob": "^3.3.2",
"fathom-client": "^3.7.2",
"feed": "^4.2.2",
"formik": "^2.4.6",
"geist": "^1.3.1",

View File

@ -1,10 +1,9 @@
import { useEffect } from "react";
import { useRouter } from "next/router";
import { DefaultSeo, SocialProfileJsonLd } from "next-seo";
import * as Fathom from "fathom-client";
import { Analytics } from "@vercel/analytics/react";
import { SpeedInsights } from "@vercel/speed-insights/next";
import { ThemeProvider } from "../contexts/ThemeContext";
import Layout from "../components/Layout";
import config from "../lib/config";
import { defaultSeo, socialProfileJsonLd } from "../lib/config/seo";
import { globalStyles, classNames } from "../lib/styles/stitches.config";
import type { ReactElement, ReactNode } from "react";
@ -25,36 +24,6 @@ const App = ({ Component, pageProps }: AppProps) => {
// NOTE: this assumes trailing slashes are enabled in next.config.js
const canonical = `${process.env.NEXT_PUBLIC_BASE_URL || ""}${router.pathname === "/" ? "" : router.pathname}/`;
useEffect(() => {
// bail immediately if the site ID is not set
if (!process.env.NEXT_PUBLIC_FATHOM_SITE_ID) {
return;
}
// don't track pageviews on branch/deploy previews and localhost
if (process.env.NEXT_PUBLIC_VERCEL_ENV !== "production") {
return;
}
// https://usefathom.com/docs/integrations/next
// https://vercel.com/guides/deploying-nextjs-using-fathom-analytics-with-vercel
Fathom.load(process.env.NEXT_PUBLIC_FATHOM_SITE_ID, {
includedDomains: [config.siteDomain],
});
const onRouteChangeComplete = (url: string) => {
Fathom.trackPageview({ url });
};
// needs to be triggered manually on link clicks (the page doesn't actually change)
router.events.on("routeChangeComplete", onRouteChangeComplete);
return () => {
// unassign event listener
router.events.off("routeChangeComplete", onRouteChangeComplete);
};
}, [router.events]);
// inject body styles defined in ../lib/styles/stitches.config.ts
globalStyles();
@ -78,6 +47,9 @@ const App = ({ Component, pageProps }: AppProps) => {
<SocialProfileJsonLd {...socialProfileJsonLd} />
<ThemeProvider classNames={classNames}>{getLayout(<Component {...pageProps} />)}</ThemeProvider>
<Analytics />
<SpeedInsights />
</>
);
};

View File

@ -63,16 +63,22 @@ const Privacy = () => {
</p>
<p>
<Link href="https://usefathom.com/ref/ZEYG0O">
<strong>Fathom Analytics</strong>
<Link href="https://vercel.com/products/observability">
<strong>Vercel Analytics</strong>
</Link>{" "}
is also used to gain insights into referrers, search terms, etc.{" "}
<Link href="https://vercel.com/docs/analytics/privacy-policy#data-point-information">
without collecting anything identifiable
</Link>{" "}
about you. Likewise,{" "}
<Link href="">
<strong>Vercel Speed Insights</strong>
</Link>{" "}
is used to gather core web vitals{" "}
<Link href="https://vercel.com/docs/speed-insights/privacy-policy#vercel-speed-insights-privacy-&-compliance">
anonymously
</Link>
, a <em>very</em> <Link href="https://usefathom.com/privacy-focused-web-analytics">privacy-focused</Link>{" "}
service, is also used to gain insights into referrers, search terms, etc.{" "}
<strong>without collecting anything identifiable about you</strong>. (My{" "}
<Link href="/stats/" openInNewTab>
dashboard is completely public
</Link>
, too!)
.
</p>
<H2 id="third-party">Third-Party Content</H2>

71
pnpm-lock.yaml generated
View File

@ -35,6 +35,12 @@ importers:
'@stitches/react':
specifier: 1.3.1-1
version: 1.3.1-1(react@18.3.1)
'@vercel/analytics':
specifier: ^1.3.1
version: 1.3.1(next@14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
'@vercel/speed-insights':
specifier: ^1.0.12
version: 1.0.12(next@14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
comma-number:
specifier: ^2.1.0
version: 2.1.0
@ -47,9 +53,6 @@ importers:
fast-glob:
specifier: ^3.3.2
version: 3.3.2
fathom-client:
specifier: ^3.7.2
version: 3.7.2
feed:
specifier: ^4.2.2
version: 4.2.2
@ -296,7 +299,6 @@ packages:
'@humanwhocodes/config-array@0.11.14':
resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
engines: {node: '>=10.10.0'}
deprecated: Use @eslint/config-array instead
'@humanwhocodes/module-importer@1.0.1':
resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
@ -304,7 +306,6 @@ packages:
'@humanwhocodes/object-schema@2.0.3':
resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==}
deprecated: Use @eslint/object-schema instead
'@img/sharp-darwin-arm64@0.33.4':
resolution: {integrity: sha512-p0suNqXufJs9t3RqLBO6vvrgr5OhgbWp76s5gTRvdmxmuv9E1rcaqGUsl3l4mKVmXPkTkTErXediAui4x+8PSA==}
@ -895,6 +896,40 @@ packages:
'@ungap/structured-clone@1.2.0':
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
'@vercel/analytics@1.3.1':
resolution: {integrity: sha512-xhSlYgAuJ6Q4WQGkzYTLmXwhYl39sWjoMA3nHxfkvG+WdBT25c563a7QhwwKivEOZtPJXifYHR1m2ihoisbWyA==}
peerDependencies:
next: '>= 13'
react: ^18 || ^19
peerDependenciesMeta:
next:
optional: true
react:
optional: true
'@vercel/speed-insights@1.0.12':
resolution: {integrity: sha512-ZGQ+a7bcfWJD2VYEp2R1LHvRAMyyaFBYytZXsfnbOMkeOvzGNVxUL7aVUvisIrTZjXTSsxG45DKX7yiw6nq2Jw==}
peerDependencies:
'@sveltejs/kit': ^1 || ^2
next: '>= 13'
react: ^18 || ^19
svelte: ^4
vue: ^3
vue-router: ^4
peerDependenciesMeta:
'@sveltejs/kit':
optional: true
next:
optional: true
react:
optional: true
svelte:
optional: true
vue:
optional: true
vue-router:
optional: true
abbrev@2.0.0:
resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==}
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
@ -1526,9 +1561,6 @@ packages:
fastq@1.17.1:
resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==}
fathom-client@3.7.2:
resolution: {integrity: sha512-sWtaNivhg7uwp/q1bUuIiNj4LeQZMEZ5NXXFFpZ8le4uDedAfQG84gPOdYehtVXbl+1yX2s8lmXZ2+IQ9a/xxA==}
feed@4.2.2:
resolution: {integrity: sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ==}
engines: {node: '>=0.4.0'}
@ -1638,7 +1670,6 @@ packages:
glob@7.2.3:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
deprecated: Glob versions prior to v9 are no longer supported
globals@13.24.0:
resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==}
@ -1781,7 +1812,6 @@ packages:
inflight@1.0.6:
resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
inherits@2.0.4:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
@ -2044,7 +2074,6 @@ packages:
libsql@0.3.19:
resolution: {integrity: sha512-Aj5cQ5uk/6fHdmeW0TiXK42FqUlwx7ytmMLPSaUQPin5HKKKuUPD62MAbN4OEweGBBI7q1BekoEN4gPUEL6MZA==}
cpu: [x64, arm64, wasm32]
os: [darwin, linux, win32]
lilconfig@3.1.2:
@ -2789,7 +2818,6 @@ packages:
rimraf@3.0.2:
resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==}
deprecated: Rimraf versions prior to v4 are no longer supported
hasBin: true
run-parallel@1.2.0:
@ -2829,6 +2857,9 @@ packages:
engines: {node: '>=10'}
hasBin: true
server-only@0.0.1:
resolution: {integrity: sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==}
set-function-length@1.2.2:
resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==}
engines: {node: '>= 0.4'}
@ -4034,6 +4065,18 @@ snapshots:
'@ungap/structured-clone@1.2.0': {}
'@vercel/analytics@1.3.1(next@14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)':
dependencies:
server-only: 0.0.1
optionalDependencies:
next: 14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
'@vercel/speed-insights@1.0.12(next@14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)':
optionalDependencies:
next: 14.2.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react: 18.3.1
abbrev@2.0.0: {}
acorn-jsx@5.3.2(acorn@8.12.1):
@ -4870,8 +4913,6 @@ snapshots:
dependencies:
reusify: 1.0.4
fathom-client@3.7.2: {}
feed@4.2.2:
dependencies:
xml-js: 1.6.11
@ -6656,6 +6697,8 @@ snapshots:
semver@7.6.3: {}
server-only@0.0.1: {}
set-function-length@1.2.2:
dependencies:
define-data-property: 1.1.4

View File

@ -35,7 +35,6 @@
- Turso
- Giscus
- Resend
- Fathom Analytics
- ...and more: https://jarv.is/uses/
# VIEW SOURCE