Skip to content

Commit

Permalink
[chore] gtag event source
Browse files Browse the repository at this point in the history
  • Loading branch information
cupoftea4 committed Nov 18, 2024
1 parent 903dfb5 commit a58b4bb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/hooks/useGTagTimetableEvents.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { useEffect } from "react";

const useGTagTimetableEvents = (group: string, source: string, isCustomSource?: boolean) => {
// biome-ignore lint/correctness/useExhaustiveDependencies: it should be sent only when the group changes
useEffect(() => {
window.gtag("event", "open_timetable", {
event_category: "Timetable",
event_label: group,
group,
source,
});
}, [group]);

Expand All @@ -15,6 +17,7 @@ const useGTagTimetableEvents = (group: string, source: string, isCustomSource?:
event_label: source ?? "url",
isCustomSource,
group,
source,
});
}, [source, isCustomSource, group]);
};
Expand Down

0 comments on commit a58b4bb

Please sign in to comment.