Skip to content

Commit

Permalink
feat (ga): Add google analytics tracking ghostnet
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilevos authored and JulesGuesnon committed Jul 27, 2023
1 parent d7ce1a0 commit 8c32668
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions context/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export const PREFERED_NETWORK =
? NetworkType.MAINNET
: NetworkType.GHOSTNET;

export const GA_TRACKING_ID =
process.env.NEXT_PUBLIC_NETWORK_TYPE === "mainnet"
? "G-QG5J5XRFF9"
: "G-32ZN7LBFPN";

export const THUMBNAIL_URL = "https://display-thumbs.dipdup.net";

export const DEFAULT_TIMEOUT = 60000;
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"next": "13.1.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-ga4": "^2.1.0",
"typescript": "4.9.3",
"uuid": "^9.0.0"
},
Expand Down
4 changes: 4 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Sidebar from "../components/Sidebar";
import Footer from "../components/footer";
import NavBar from "../components/navbar";
import { PREFERED_NETWORK } from "../context/config";
import { GA_TRACKING_ID } from "../context/config";
import {
tezosState,
action,
Expand All @@ -26,6 +27,9 @@ import {
} from "../context/state";
import "../styles/globals.css";
import Proposals from "./proposals";
import ReactGA from "react-ga4";

ReactGA.initialize(GA_TRACKING_ID);

export default function App({ Component, pageProps }: AppProps) {
const [state, dispatch]: [tezosState, React.Dispatch<action>] = useReducer(
Expand Down

0 comments on commit 8c32668

Please sign in to comment.