Skip to content

Commit

Permalink
conf(ga): config analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlie85270 committed Dec 24, 2020
1 parent 186fe30 commit 7182bfd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
3 changes: 0 additions & 3 deletions components/layout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ export const menuEntry = [
];

const AppLayout = ({ title, desc, children }) => {
useEffect(() => {
ReactGA.pageview(window.location.pathname);
}, []);
return (
<div className="relative bg-white">
<Meta pageTitle={title} description={desc} />
Expand Down
3 changes: 0 additions & 3 deletions components/layout/HomeLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import ReactGA from "react-ga";
import Meta from "../site/Meta";

const HomeLayout: FC = ({ children }) => {
useEffect(() => {
ReactGA.pageview(window.location.pathname);
}, []);
return (
<>
<Meta
Expand Down
15 changes: 8 additions & 7 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from "react";
import { FC, useEffect } from "react";
import { AppProps } from "next/app";
import "@fortawesome/fontawesome-free/js/fontawesome";
import "@fortawesome/fontawesome-free/js/solid";
Expand All @@ -12,10 +12,11 @@ config.autoAddCss = false;
import "../global.css";
import ReactGA from "react-ga";

ReactGA.initialize("G-1KT9X3Z5KR");

const App: FC<AppProps> = ({ Component, pageProps }: AppProps) => (
<Component {...pageProps} />
);

const App: FC<AppProps> = ({ Component, pageProps }: AppProps) => {
useEffect(() => {
ReactGA.initialize("G-1KT9X3Z5KR", { debug: true });
ReactGA.pageview(window.location.pathname);
}, []);
return <Component {...pageProps} />;
};
export default App;

0 comments on commit 7182bfd

Please sign in to comment.