Skip to content

Commit

Permalink
Custom tracking was disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramin Farhadi authored and Ramin Farhadi committed Jul 25, 2024
1 parent 82a1466 commit 8bfa535
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 22 deletions.
40 changes: 24 additions & 16 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ const REACT_MEASUREMENT_ID = import.meta.env.VITE_REACTGA_MEASUREMENT_ID || '';

function App() {

if(REACT_MEASUREMENT_ID) {
ReactGA.initialize(REACT_MEASUREMENT_ID)
// Send pageview with a custom path
ReactGA.send({ hitType: "pageview", page: "/map/", title: "UCF Campus Map" });
}
const initialLng = -81.200142;
const intitalLat = 28.602368;
const initialZoom = 15;
Expand Down Expand Up @@ -212,12 +207,18 @@ function App() {
if (response.length > 0) {
const location = response.pop();

ReactGA.gtag('event', 'click_internal_link', {
'event_category': 'link',
'event_label': `${location!.title.rendered}`,
'link_text': `${location!.title.rendered}`,
'link_url': `${location!.link}`
});
ReactGA.event({
category: "link",
action: "click_internal_link",
label: `${location!.title.rendered}`,
});

// ReactGA.gtag('event', 'click_internal_link', {
// 'event_category': 'link',
// 'event_label': `${location!.title.rendered}`,
// 'link_text': `${location!.title.rendered}`,
// 'link_url': `${location!.link}`
// });

html = `<a class="location-link" href="${location!.link}" onClick="{() => trackLinkClick(${location!.title.rendered}) }" target="_blank">${feature?.properties?.Name}</a>`;
} else {
Expand Down Expand Up @@ -272,11 +273,18 @@ function App() {

const campusHandler = (campus: Campus) => {

ReactGA.gtag('event', 'click_campus_menu', {
'event_category': 'campus_menu',
'event_label': `${campus.name}`,
'link_text': `${campus.name}`
});
ReactGA.event({
category: "campus_menu",
action: "click_campus_menu",
label: `${campus.name}`,
});


// ReactGA.gtag('event', 'click_campus_menu', {
// 'event_category': 'campus_menu',
// 'event_label': `${campus.name}`,
// 'link_text': `${campus.name}`
// });

mapRef.current!.flyTo({
center: [
Expand Down
20 changes: 14 additions & 6 deletions src/components/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@ export default function SearchResults(props: SearchResultsProps) {
}, [searchQuery, 500])

useEffect(() => {
ReactGA.event({
category: "map_search",
action: "search",
label: `${debouncedSearchQuery}`,
});
},[debouncedSearchQuery])

// useEffect(() => {

ReactGA.gtag('event', 'search', {
'event_category': 'map_search',
'event_label': `${debouncedSearchQuery}`,
'link_text': `${debouncedSearchQuery}`,
});
// ReactGA.gtag('event', 'search', {
// 'event_category': 'map_search',
// 'event_label': `${debouncedSearchQuery}`,
// 'link_text': `${debouncedSearchQuery}`,
// });

},[debouncedSearchQuery])
// },[debouncedSearchQuery])

return (
<div className='search-control-wrapper rounded'>
Expand Down

0 comments on commit 8bfa535

Please sign in to comment.