website: Add Fathom analytics (#12534)

* Impl Fathom analytics

* Use analytics package instead of direct impl
This commit is contained in:
Noel Quiles 2021-10-13 15:14:04 -04:00 committed by GitHub
parent 71fef3fa16
commit 2eb4406e2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 68 additions and 11 deletions

View File

@ -9,6 +9,7 @@
"version": "1.0.0",
"dependencies": {
"@hashicorp/mktg-global-styles": "^4.0.0",
"@hashicorp/platform-analytics": "^0.1.0",
"@hashicorp/platform-code-highlighting": "^0.1.2",
"@hashicorp/platform-runtime-error-monitoring": "^0.1.0",
"@hashicorp/platform-util": "^0.1.0",
@ -28,6 +29,7 @@
"@hashicorp/react-subnav": "^9.0.1",
"@hashicorp/react-tabs": "^7.0.1",
"@hashicorp/react-vertical-text-block-list": "^7.0.0",
"fathom-client": "^3.2.0",
"next": "^11.1.2",
"next-mdx-remote": "3.0.1",
"next-remote-watch": "^1.0.0",
@ -1322,6 +1324,17 @@
"node": ">=4.2.0"
}
},
"node_modules/@hashicorp/platform-analytics": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@hashicorp/platform-analytics/-/platform-analytics-0.1.0.tgz",
"integrity": "sha512-kR/E0KWemjazSrSFN9l22v8JqlQvkgjgkZHPJEhGiBt05LMtt2ugxIakv+gnzW5lU9434nnr7oDooUyj4eufPA==",
"dependencies": {
"fathom-client": "^3.2.0"
},
"peerDependencies": {
"react": ">= 16.x"
}
},
"node_modules/@hashicorp/platform-cli": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@hashicorp/platform-cli/-/platform-cli-1.2.0.tgz",
@ -3139,9 +3152,13 @@
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-11.1.2.tgz",
"integrity": "sha512-hZuwOlGOwBZADA8EyDYyjx3+4JGIGjSHDHWrmpI7g5rFmQNltjlbaefAbiU5Kk7j3BUSDwt30quJRFv3nyJQ0w==",
"cpu": ["arm64"],
"cpu": [
"arm64"
],
"optional": true,
"os": ["darwin"],
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
@ -3150,9 +3167,13 @@
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-11.1.2.tgz",
"integrity": "sha512-PGOp0E1GisU+EJJlsmJVGE+aPYD0Uh7zqgsrpD3F/Y3766Ptfbe1lEPPWnRDl+OzSSrSrX1lkyM/Jlmh5OwNvA==",
"cpu": ["x64"],
"cpu": [
"x64"
],
"optional": true,
"os": ["darwin"],
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
@ -3161,9 +3182,13 @@
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-11.1.2.tgz",
"integrity": "sha512-YcDHTJjn/8RqvyJVB6pvEKXihDcdrOwga3GfMv/QtVeLphTouY4BIcEUfrG5+26Nf37MP1ywN3RRl1TxpurAsQ==",
"cpu": ["x64"],
"cpu": [
"x64"
],
"optional": true,
"os": ["linux"],
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
@ -3172,9 +3197,13 @@
"version": "11.1.2",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-11.1.2.tgz",
"integrity": "sha512-e/pIKVdB+tGQYa1cW3sAeHm8gzEri/HYLZHT4WZojrUxgWXqx8pk7S7Xs47uBcFTqBDRvK3EcQpPLf3XdVsDdg==",
"cpu": ["x64"],
"cpu": [
"x64"
],
"optional": true,
"os": ["win32"],
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
@ -6306,7 +6335,9 @@
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"engines": ["node >= 0.8"],
"engines": [
"node >= 0.8"
],
"peer": true,
"dependencies": {
"buffer-from": "^1.0.0",
@ -8552,6 +8583,11 @@
"reusify": "^1.0.4"
}
},
"node_modules/fathom-client": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fathom-client/-/fathom-client-3.2.0.tgz",
"integrity": "sha512-WF/qA5wXYSuA5K8uiIhGNbErOcTAmfLEWrBxWP2px2dEc9waH9zxjdh9k0F907VCBhdJrv+f7V3HT/Pmro40zA=="
},
"node_modules/fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
@ -8974,7 +9010,9 @@
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"hasInstallScript": true,
"optional": true,
"os": ["darwin"],
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
@ -20642,7 +20680,9 @@
"deprecated": "fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.",
"hasInstallScript": true,
"optional": true,
"os": ["darwin"],
"os": [
"darwin"
],
"peer": true,
"dependencies": {
"bindings": "^1.5.0",
@ -22454,6 +22494,14 @@
}
}
},
"@hashicorp/platform-analytics": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@hashicorp/platform-analytics/-/platform-analytics-0.1.0.tgz",
"integrity": "sha512-kR/E0KWemjazSrSFN9l22v8JqlQvkgjgkZHPJEhGiBt05LMtt2ugxIakv+gnzW5lU9434nnr7oDooUyj4eufPA==",
"requires": {
"fathom-client": "^3.2.0"
}
},
"@hashicorp/platform-cli": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@hashicorp/platform-cli/-/platform-cli-1.2.0.tgz",
@ -28116,6 +28164,11 @@
"reusify": "^1.0.4"
}
},
"fathom-client": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fathom-client/-/fathom-client-3.2.0.tgz",
"integrity": "sha512-WF/qA5wXYSuA5K8uiIhGNbErOcTAmfLEWrBxWP2px2dEc9waH9zxjdh9k0F907VCBhdJrv+f7V3HT/Pmro40zA=="
},
"fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",

View File

@ -5,6 +5,7 @@
"author": "HashiCorp",
"dependencies": {
"@hashicorp/mktg-global-styles": "^4.0.0",
"@hashicorp/platform-analytics": "^0.1.0",
"@hashicorp/platform-code-highlighting": "^0.1.2",
"@hashicorp/platform-runtime-error-monitoring": "^0.1.0",
"@hashicorp/platform-util": "^0.1.0",
@ -24,6 +25,7 @@
"@hashicorp/react-subnav": "^9.0.1",
"@hashicorp/react-tabs": "^7.0.1",
"@hashicorp/react-vertical-text-block-list": "^7.0.0",
"fathom-client": "^3.2.0",
"next": "^11.1.2",
"next-mdx-remote": "3.0.1",
"next-remote-watch": "^1.0.0",

View File

@ -4,6 +4,7 @@ import '@hashicorp/platform-util/nprogress/style.css'
import Min100Layout from '@hashicorp/react-min-100-layout'
import NProgress from '@hashicorp/platform-util/nprogress'
import createConsentManager from '@hashicorp/react-consent-manager/loader'
import useFathomAnalytics from '@hashicorp/platform-analytics'
import useAnchorLinkAnalytics from '@hashicorp/platform-util/anchor-link-analytics'
import Router from 'next/router'
import HashiHead from '@hashicorp/react-head'
@ -22,6 +23,7 @@ const { ConsentManager, openConsentManager } = createConsentManager({
})
export default function App({ Component, pageProps }) {
useFathomAnalytics()
useAnchorLinkAnalytics()
return (