2019-11-25 00:51:03 +00:00
|
|
|
import * as React from 'react'
|
2019-08-28 15:28:59 +00:00
|
|
|
import App from 'next/app';
|
2019-12-31 17:28:17 +00:00
|
|
|
import { trackPageview, load, setSiteId } from 'fathom-client'
|
2019-11-25 00:51:03 +00:00
|
|
|
import Router from 'next/router'
|
|
|
|
|
import Providers from '../components/Providers';
|
|
|
|
|
|
|
|
|
|
Router.events.on('routeChangeComplete', () => {
|
2019-12-31 17:28:17 +00:00
|
|
|
trackPageview()
|
2019-11-25 00:51:03 +00:00
|
|
|
})
|
|
|
|
|
|
2019-12-31 17:28:17 +00:00
|
|
|
function FathomProvider(props) {
|
2019-11-25 00:51:03 +00:00
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
2019-12-31 17:28:17 +00:00
|
|
|
load();
|
|
|
|
|
setSiteId('ESMHTGZE');
|
|
|
|
|
trackPageview();
|
2019-11-25 00:51:03 +00:00
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
return <div {...props} />
|
|
|
|
|
}
|
2019-01-13 01:52:43 +00:00
|
|
|
|
2019-11-25 00:51:03 +00:00
|
|
|
class MyApp extends App {
|
2019-01-13 01:52:43 +00:00
|
|
|
render() {
|
|
|
|
|
const { Component, pageProps } = this.props;
|
|
|
|
|
return (
|
2019-12-31 17:28:17 +00:00
|
|
|
<FathomProvider>
|
2019-11-25 00:51:03 +00:00
|
|
|
<Providers>
|
|
|
|
|
<Component {...pageProps} />
|
|
|
|
|
</Providers>
|
2019-12-31 17:28:17 +00:00
|
|
|
</FathomProvider>
|
2019-01-13 01:52:43 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-25 00:51:03 +00:00
|
|
|
export default MyApp;
|