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, + }) +}