Skip to content

Commit

Permalink
additional tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
dickreuter committed Feb 9, 2024
1 parent 7b72982 commit 175be6e
Show file tree
Hide file tree
Showing 4 changed files with 308 additions and 287 deletions.
7 changes: 4 additions & 3 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@
"@material-ui/core": "^4.12.4",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.4",
"@nivo/bar": "^0.83.0",
"@nivo/bar": "^0.55.0",
"@nivo/core": "^0.83.0",
"@nivo/scatterplot": "^0.83.0",
"@nivo/scatterplot": "^0.55.0",
"axios": "^1.4.0",
"bootstrap": "^5.3.1",
"chart.js": "^4.3.3",
"deps": "^1.0.0",
"nivo": "^0.31.0",
"nivo": "^0.2.0",
"react": "^18.2.0",
"react-bootstrap": "^2.8.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-ga": "^3.3.1",
"react-ga4": "^2.1.0",
"react-router-dom": "^6.15.0",
"recharts": "^2.7.3",
"victory": "^36.6.11"
Expand Down
4 changes: 2 additions & 2 deletions website/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import "./App.css";
import NavBar from "./routes/NavBar";
import Routing from "./routes/Routing";
import { useEffect } from "react";
import ReactGA4 from "react-ga4";

const TRACKING_ID = "UA-7794836-7"; // OUR_TRACKING_ID
ReactGA.initialize(TRACKING_ID);
ReactGA4.initialize("G-H40Z0W36GF");

function App() {
useEffect(() => {
Expand Down
152 changes: 84 additions & 68 deletions website/src/routes/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,96 @@ import React, { useState } from 'react';
import 'bootstrap/dist/css/bootstrap.css';
import { Link } from 'react-router-dom';
import { useDlLink } from '../views/config';
import ReactGA from 'react-ga4';

function NavBar() {
// State to manage the toggle status of the navbar
const [isOpen, setIsOpen] = useState(false);
const dlLink = useDlLink();
const [isOpen, setIsOpen] = useState(false);
const dlLink = useDlLink(); // Assume this hook provides a dynamic download link

// Function to toggle the navbar
const toggle = () => {
setIsOpen(!isOpen);
};
const toggle = () => {
setIsOpen(!isOpen);
};

return (
<nav className="navbar navbar-expand-sm fixed-top navbar-light bg-light">
<button
className="navbar-toggler"
type="button"
onClick={toggle} // Toggle the navbar on click
aria-label="Toggle navigation"
const handleGAEvent = (category, action, label) => {
ReactGA.event({
category: category,
action: action,
label: label,
});
};

// Enhanced function to handle click events for both React Router Link and regular anchor tags
const handleNavLinkClick = (label) => {
if (window.innerWidth <= 768) {
toggle();
}
handleGAEvent('Navigation', 'Link Click', label);
};

return (
<nav className="navbar navbar-expand-sm fixed-top navbar-light bg-light">
<button
className="navbar-toggler"
type="button"
onClick={() => handleNavLinkClick('Navbar Toggle')}
aria-label="Toggle navigation"
>
<span className="navbar-toggler-icon"></span>
</button>
<a className="navbar-brand" href="/" onClick={() => handleNavLinkClick('DeeperMind PokerBot')}>
DeeperMind PokerBot
</a>

<div className={`collapse navbar-collapse ${isOpen ? 'show' : ''}`} id="navbarTogglerDemo03">
<ul className="navbar-nav mr-auto">
<li className="nav-item">
<a className="nav-link" href={dlLink} onClick={() => handleNavLinkClick('Download')}>
Download
</a>
</li>
<li className="nav-item">
<Link className="nav-link" to="/purchase" onClick={() => handleNavLinkClick('Purchase')}>
Purchase
</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/strategyanalyzer" onClick={() => handleNavLinkClick('Strategies')}>
Strategies
</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/tableanalyzer" onClick={() => handleNavLinkClick('Table Mappings')}>
Table mappings
</Link>
</li>
<li className="nav-item">
<a className="nav-link" href="https://discord.gg/xB9sR3Q7r3" onClick={() => handleNavLinkClick('Support Chat')}>
Support chat
</a>
</li>
<li className="nav-item">
<a className="nav-link" href="https://github.com/dickreuter/Poker" onClick={() => handleNavLinkClick('Source Code')}>
Source code
</a>
</li>
<li className="nav-item">
<a
className="nav-link"
href="https://github.com/dickreuter/Poker/blob/master/readme.rst"
onClick={() => handleNavLinkClick('Documentation')}
>
<span className="navbar-toggler-icon"></span>
</button>
<a className="navbar-brand" href="/">
DeeperMind PokerBot
Documentation
</a>

<div className={`collapse navbar-collapse ${isOpen ? 'show' : ''}`} id="navbarTogglerDemo03">
<ul className="navbar-nav mr-auto">
<li className="nav-item">
<a className="nav-link" href={dlLink}>
Download
</a>
</li>
<li className="nav-item">
<Link className="nav-link" to="/purchase">
Purchase
</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/strategyanalyzer">
Strategies
</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/tableanalyzer">
Table mappings
</Link>
</li>
<li className="nav-item">
<a className="nav-link" href="https://discord.gg/xB9sR3Q7r3">
Support chat
</a>
</li>
<li className="nav-item">
<a className="nav-link" href="https://github.com/dickreuter/Poker">
Source code
</a>
</li>
<li className="nav-item">
<a
className="nav-link"
href="https://github.com/dickreuter/Poker/blob/master/readme.rst"
>
Documentation
</a>
</li>
<li className="nav-item">
<a className="nav-link" href="http://www.betfair-bot.com">
Betfair Bot
</a>
</li>
</ul>
</div>
</nav>
);
</li>
<li className="nav-item">
<a className="nav-link" href="http://www.betfair-bot.com" onClick={() => handleNavLinkClick('Betfair Bot')}>
Betfair Bot
</a>
</li>
</ul>
</div>
</nav>
);
}

export default NavBar;
Loading

0 comments on commit 175be6e

Please sign in to comment.