Skip to content

Commit

Permalink
customEventType added in order to load custom dimentions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramin Farhadi authored and Ramin Farhadi committed Jul 24, 2024
1 parent 24b7bdf commit 0ae7b08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { Visibility } from './types/Visibility';

// Data Imports
import campusData from './assets/campuses.json';
import { CustomEventOptions } from './types/CustomEventOptions';

const TOKEN = import.meta.env.VITE_MAPBOX_TOKEN;
const FOOTER_MENU_ID = import.meta.env.VITE_REMOTE_FOOTER_MENU_ID;
Expand Down Expand Up @@ -205,14 +206,16 @@ function App() {

if (response.length > 0) {
const location = response.pop();
ReactGA.event({

const internalLinkClickGa4: CustomEventOptions = {
category: "link",
action: "click_internal_link",
label: `${location!.title.rendered}`,
},{
link_url: `${location!.link}`,
link_text: `${location!.title.rendered}`
})
}

ReactGA.event(internalLinkClickGa4)

html = `<a class="location-link" href="${location!.link}" onClick="{() => trackLinkClick(${location!.title.rendered}) }" target="_blank">${feature?.properties?.Name}</a>`;
} else {
Expand Down
6 changes: 6 additions & 0 deletions src/types/CustomEventOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { UaEventOptions } from "react-ga4/types/ga4"

export interface CustomEventOptions extends UaEventOptions {
link_url: string,
link_text: string
}

0 comments on commit 0ae7b08

Please sign in to comment.