Skip to content

Data analytics #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 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 @@ -14,6 +14,7 @@
"next": "^13.5.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-ga4": "^2.1.0",
"react-icons": "^4.8.0"
},
"devDependencies": {
Expand Down
9 changes: 8 additions & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ import About from "@/components/About";
import Projects from "@/components/Projects";
import Timeline from "@/components/Timeline";
import Footer from "@/components/Footer";
import React from 'react';
import ReactGA from 'react-ga4'; // ga4 import

export default function Home() {

const TRACKING_ID = "G-4TRT9PDZQ9"; // Change tracking ID to use your own on Google Analytics. ID currently set is used for my development environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generated G-9J724Z10KJ using the [email protected]

Suggested change
const TRACKING_ID = "G-4TRT9PDZQ9"; // Change tracking ID to use your own on Google Analytics. ID currently set is used for my development environment.
const TRACKING_ID = "G-9J724Z10KJ";

ReactGA.initialize(TRACKING_ID);
// ReactGA.pageview(document.location.pathname); // This line is currently causing 'ReferenceError: document is not defined in reactjs'

return (
<>
<main>
Expand All @@ -15,7 +22,7 @@ export default function Home() {
</main>
<footer>
<Footer />
</footer>
</footer>
</>
);
}