First Commit - Portfolio Page

This commit is contained in:
2025-02-10 00:55:39 +01:00
commit bba0e331a8
239 changed files with 33355 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
import ReactGA from 'react-ga4';
const TRACKING_ID = 'G-N0PZBL7X18';
export const initGA = () => {
ReactGA.initialize(TRACKING_ID);
};
export const logPageView = () => {
ReactGA.send({ hitType: "pageview", page: window.location.pathname });
};
export const trackEvent = (category: string, action: string, label?: string) => {
ReactGA.event({
category,
action,
label
});
};
export const trackConversion = (value?: number) => {
ReactGA.event({
category: 'Conversion',
action: 'Complete',
value
});
};
export const trackTiming = (category: string, variable: string, value: number) => {
ReactGA.event({
category,
action: 'timing',
label: variable,
value
});
};
declare global {
interface Window {
initializeAnalytics: () => void;
}
}
// Make analytics initialization available globally for the cookie consent
window.initializeAnalytics = () => {
initGA();
logPageView();
};