Skip to content

Commit

Permalink
✨ feat: logEvent 유틸 함수 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
bbearcookie committed Apr 23, 2024
1 parent b30589d commit c8f755a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/utils/logEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** Google Analytics에게 수집할 이벤트를 전달합니다. */
export const logEvent = <Command extends keyof Gtag.GtagCommands>(
command: Command,
...args: Gtag.GtagCommands[Command]
): void => {
if (!window.gtag) {
throw new Error('Google Analytics is not initialized');
}

window.gtag(command, ...args);
};

0 comments on commit c8f755a

Please sign in to comment.