diff --git a/package.json b/package.json index 11aac38..7e9051a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "lint:staged": "lint-staged" }, "dependencies": { - "fathom-client": "^1.0.0", + "fathom-client": "^2.0.2", "next": "^9.1.6", "next-seo": "^3.2.0", "react": "^16.12.0", diff --git a/pages/_app.js b/pages/_app.js index fa98c92..9df89a1 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,19 +1,19 @@ import * as React from 'react' import App from 'next/app'; -import Fathom from 'fathom-client' +import { trackPageview, load, setSiteId } from 'fathom-client' import Router from 'next/router' import Providers from '../components/Providers'; Router.events.on('routeChangeComplete', () => { - Fathom.trackPageview() + trackPageview() }) -function FathomWrapper(props) { +function FathomProvider(props) { React.useEffect(() => { if (process.env.NODE_ENV === 'production') { - Fathom.load(); - Fathom.setSiteId('ESMHTGZE'); - Fathom.trackPageview(); + load(); + setSiteId('ESMHTGZE'); + trackPageview(); } }, []) return
@@ -23,11 +23,11 @@ class MyApp extends App { render() { const { Component, pageProps } = this.props; return ( -