-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add individual search events (#31)
* feat: add individual search events * doc: fix doc in analyticsa * fix: undefined uni
- Loading branch information
1 parent
84c7a88
commit f530f98
Showing
4 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export const analyticsEnum = { | ||
search: { | ||
title: "Search Page", | ||
actions: { | ||
SEARCH: "Search Course", // Label is school, value is index of GE | ||
}, | ||
}, | ||
}; | ||
|
||
interface AnalyticsProps { | ||
category: string; | ||
action: string; | ||
label?: string; | ||
value?: number; | ||
} | ||
|
||
export function logAnalytics({ | ||
category, | ||
action, | ||
label, | ||
value, | ||
}: AnalyticsProps) { | ||
(window as any).gtag("event", action, { | ||
event_category: category, | ||
event_label: label, | ||
value: value, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters