From 6c2a2d5eb9ec74aeb24e53d6936227bcc9e50d3c Mon Sep 17 00:00:00 2001 From: junkisai Date: Thu, 19 Dec 2024 18:00:12 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=88=20:=20add=20toggleLogEvent=20utili?= =?UTF-8?q?ty=20for=20logging=20toggle=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/.changeset/slimy-cycles-press.md | 6 ++++++ .../erd-core/src/features/gtm/utils/index.ts | 1 + .../src/features/gtm/utils/toggleLogEvent.ts | 14 ++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 frontend/.changeset/slimy-cycles-press.md create mode 100644 frontend/packages/erd-core/src/features/gtm/utils/toggleLogEvent.ts diff --git a/frontend/.changeset/slimy-cycles-press.md b/frontend/.changeset/slimy-cycles-press.md new file mode 100644 index 000000000..3f18212d6 --- /dev/null +++ b/frontend/.changeset/slimy-cycles-press.md @@ -0,0 +1,6 @@ +--- +"@liam-hq/erd-core": patch +"@liam-hq/cli": patch +--- + +📈 : add toggleLogEvent utility for logging toggle actions diff --git a/frontend/packages/erd-core/src/features/gtm/utils/index.ts b/frontend/packages/erd-core/src/features/gtm/utils/index.ts index c5b245046..bd571fa8d 100644 --- a/frontend/packages/erd-core/src/features/gtm/utils/index.ts +++ b/frontend/packages/erd-core/src/features/gtm/utils/index.ts @@ -1,2 +1,3 @@ export * from './clickLogEvent' export * from './selectTableLogEvent' +export * from './toggleLogEvent' diff --git a/frontend/packages/erd-core/src/features/gtm/utils/toggleLogEvent.ts b/frontend/packages/erd-core/src/features/gtm/utils/toggleLogEvent.ts new file mode 100644 index 000000000..a2ae05a98 --- /dev/null +++ b/frontend/packages/erd-core/src/features/gtm/utils/toggleLogEvent.ts @@ -0,0 +1,14 @@ +import { pushToDataLayer } from './pushToDataLayer' + +type ToggleLogEvent = { + element: string + isShow: boolean + tableId?: string +} + +export const toggleLogEvent = (params: ToggleLogEvent) => { + pushToDataLayer({ + event: 'toggle', + ...params, + }) +}