mirror of
https://github.com/System-End/site.git
synced 2026-04-19 20:55:09 +00:00
Add Fathom
This commit is contained in:
parent
e868b617a7
commit
9ae0c45f43
3 changed files with 31 additions and 11 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
"@next/mdx": "^9.4.4",
|
"@next/mdx": "^9.4.4",
|
||||||
"@segment/snippet": "^4.12.0",
|
"@segment/snippet": "^4.12.0",
|
||||||
"airtable-plus": "^1.0.4",
|
"airtable-plus": "^1.0.4",
|
||||||
|
"fathom-client": "^3.0.0",
|
||||||
"isomorphic-unfetch": "^3.0.0",
|
"isomorphic-unfetch": "^3.0.0",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"next": "^9.4.4",
|
"next": "^9.4.4",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import * as React from 'react'
|
import React, { useEffect } from 'react'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
import NextApp from 'next/app'
|
import NextApp from 'next/app'
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
|
|
||||||
|
|
@ -6,15 +7,28 @@ import Meta from '@hackclub/meta'
|
||||||
import '@hackclub/theme/fonts/reg-bold.css'
|
import '@hackclub/theme/fonts/reg-bold.css'
|
||||||
import theme from '../lib/theme'
|
import theme from '../lib/theme'
|
||||||
import { ThemeProvider } from 'theme-ui'
|
import { ThemeProvider } from 'theme-ui'
|
||||||
|
import * as Fathom from 'fathom-client'
|
||||||
|
|
||||||
export default class App extends NextApp {
|
const App = ({ Component, pageProps }) => {
|
||||||
render() {
|
const router = useRouter()
|
||||||
const { Component, pageProps } = this.props
|
|
||||||
return (
|
useEffect(() => {
|
||||||
<ThemeProvider theme={theme}>
|
Fathom.load('OGIMJEFA', {
|
||||||
<Meta as={Head} />
|
includedDomains: ['hackclub.com', 'v3.hackclub.com']
|
||||||
<Component {...pageProps} />
|
})
|
||||||
</ThemeProvider>
|
const onRouteChangeComplete = () => Fathom.trackPageview()
|
||||||
)
|
router.events.on('routeChangeComplete', onRouteChangeComplete)
|
||||||
}
|
return () => {
|
||||||
|
router.events.off('routeChangeComplete', onRouteChangeComplete)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ThemeProvider theme={theme}>
|
||||||
|
<Meta as={Head} />
|
||||||
|
<Component {...pageProps} />
|
||||||
|
</ThemeProvider>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default App
|
||||||
|
|
|
||||||
|
|
@ -3396,6 +3396,11 @@ fast-json-stable-stringify@^2.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
|
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
|
||||||
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
|
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
|
||||||
|
|
||||||
|
fathom-client@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/fathom-client/-/fathom-client-3.0.0.tgz#409c047cf1e2fea45b148e28d50fcd635e992893"
|
||||||
|
integrity sha512-d0oH2SHWCMIVLbbegB7nBIjSvbqbHrZBZxIOWSVAxlJL/roL0Ah9NNb6rTIcKMlA4gov9AjWQGEcZRzlnGc3XQ==
|
||||||
|
|
||||||
figgy-pudding@^3.5.1:
|
figgy-pudding@^3.5.1:
|
||||||
version "3.5.1"
|
version "3.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790"
|
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue