Skip to content

Commit 2d92eea

Browse files
committed
Add action name to options by default
1 parent d1c0019 commit 2d92eea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/api/analytics.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { event as gtEvent } from "nextjs-google-analytics";
22

3-
const sendEvent: typeof gtEvent = (...args) => {
3+
const sendEvent: typeof gtEvent = (actionName, options) => {
44
try {
5-
console.log(...args);
6-
gtEvent(...args);
5+
if (options) options.event_name = actionName;
6+
gtEvent(actionName, options);
77
} catch (error) {
88
console.warn(error);
99
}

0 commit comments

Comments
 (0)