Skip to content

Commit

Permalink
Merge branch 'react-ga4' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramin Farhadi authored and Ramin Farhadi committed Jul 16, 2024
2 parents 6c22c83 + 552e22f commit 85be627
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,15 @@ function App() {

if (response.length > 0) {
const location = response.pop();
html = `<a class="location-link" href="${location!.link}" target="_blank">${feature?.properties?.Name}</a>`;

ReactGA.event({
category: "Link",
action: "click",
label: `${location!.title.rendered}`,
});

console.log(location!.title.rendered);
html = `<a class="location-link" href="${location!.link}" onClick="{() => trackLinkClick(${location!.title.rendered}) }" target="_blank">${feature?.properties?.Name}</a>`;
} else {
html = `<span class="location-link">${feature?.properties?.Name}</span>`
}
Expand All @@ -230,6 +238,7 @@ function App() {
};

const onSearchResultClick = (result: GeoJsonProperties) => {
// console.log(result);
mapRef.current!.flyTo({
center: [
result!.properties.Longitude,
Expand Down
1 change: 1 addition & 0 deletions src/services/LocationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface LocationResult {
slug: string;
status: string;
link: string;
title: {rendered: string};
}

export function SearchForLocation(location_name: string) {
Expand Down

0 comments on commit 85be627

Please sign in to comment.