diff --git a/src/utils/logEvent.ts b/src/utils/logEvent.ts new file mode 100644 index 0000000..551bdea --- /dev/null +++ b/src/utils/logEvent.ts @@ -0,0 +1,11 @@ +/** Google Analytics에게 수집할 이벤트를 전달합니다. */ +export const logEvent = ( + command: Command, + ...args: Gtag.GtagCommands[Command] +): void => { + if (!window.gtag) { + throw new Error('Google Analytics is not initialized'); + } + + window.gtag(command, ...args); +};