From b83905762ab14f8ce5cf996e7bc8fbd365aa30fa Mon Sep 17 00:00:00 2001 From: "ryota.sasazawa" Date: Thu, 19 Dec 2024 18:15:47 +0900 Subject: [PATCH 1/4] feat: Add openRelatedTablesLogEvent --- .../erd-core/src/features/gtm/utils/index.ts | 1 + .../gtm/utils/openRelatedTablesLogEvent.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts 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 bd571fa8d..4d428a4cb 100644 --- a/frontend/packages/erd-core/src/features/gtm/utils/index.ts +++ b/frontend/packages/erd-core/src/features/gtm/utils/index.ts @@ -1,3 +1,4 @@ export * from './clickLogEvent' export * from './selectTableLogEvent' export * from './toggleLogEvent' +export * from './openRelatedTablesLogEvent' diff --git a/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts b/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts new file mode 100644 index 000000000..3c21e19ce --- /dev/null +++ b/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts @@ -0,0 +1,14 @@ +import { pushToDataLayer } from './pushToDataLayer' + +type OpenRelatedTablesLogEvent = { + tableId: string +} + +export const OpenRelatedTablesLogEvent = ({ + tableId, +}: OpenRelatedTablesLogEvent) => { + pushToDataLayer({ + event: 'open_related_tables', + tableId, + }) +} From 486286a29065b3bfaaaf0ae6bde5377cc736badb Mon Sep 17 00:00:00 2001 From: "ryota.sasazawa" Date: Thu, 19 Dec 2024 18:23:05 +0900 Subject: [PATCH 2/4] feat: Send openRelatedTablesLogEvent when opening related tables on main area --- frontend/.changeset/dry-islands-flash.md | 6 ++++++ .../TableNode/TableDetail/RelatedTables/RelatedTables.tsx | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 frontend/.changeset/dry-islands-flash.md diff --git a/frontend/.changeset/dry-islands-flash.md b/frontend/.changeset/dry-islands-flash.md new file mode 100644 index 000000000..45e9bdca9 --- /dev/null +++ b/frontend/.changeset/dry-islands-flash.md @@ -0,0 +1,6 @@ +--- +"@liam-hq/erd-core": patch +"@liam-hq/cli": patch +--- + +📈 : Add open related tables log event diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx index 0dc6e856a..6c4df83a0 100644 --- a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx +++ b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx @@ -1,4 +1,5 @@ import { convertDBStructureToNodes } from '@/components/ERDRenderer/convertDBStructureToNodes' +import { OpenRelatedTablesLogEvent } from '@/features/gtm/utils' import { replaceHiddenNodeIds, updateActiveTableName, @@ -33,7 +34,10 @@ export const RelatedTables: FC = ({ table }) => { replaceHiddenNodeIds(hiddenNodeIds) updateActiveTableName(undefined) - }, [nodes, getNodes]) + OpenRelatedTablesLogEvent({ + tableId: table.name, + }) + }, [nodes, getNodes, table.name]) return (
From f9dc85eae030735d2495f58ff2b4a595234a4257 Mon Sep 17 00:00:00 2001 From: Ryota Sasazawa <65695538+sasamuku@users.noreply.github.com> Date: Thu, 19 Dec 2024 18:39:03 +0900 Subject: [PATCH 3/4] Update frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts Co-authored-by: Junki Saito --- .../TableNode/TableDetail/RelatedTables/RelatedTables.tsx | 4 ++-- .../src/features/gtm/utils/openRelatedTablesLogEvent.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx index 6c4df83a0..42e9d0173 100644 --- a/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx +++ b/frontend/packages/erd-core/src/components/ERDRenderer/ERDContent/TableNode/TableDetail/RelatedTables/RelatedTables.tsx @@ -1,5 +1,5 @@ import { convertDBStructureToNodes } from '@/components/ERDRenderer/convertDBStructureToNodes' -import { OpenRelatedTablesLogEvent } from '@/features/gtm/utils' +import { openRelatedTablesLogEvent } from '@/features/gtm/utils' import { replaceHiddenNodeIds, updateActiveTableName, @@ -34,7 +34,7 @@ export const RelatedTables: FC = ({ table }) => { replaceHiddenNodeIds(hiddenNodeIds) updateActiveTableName(undefined) - OpenRelatedTablesLogEvent({ + openRelatedTablesLogEvent({ tableId: table.name, }) }, [nodes, getNodes, table.name]) diff --git a/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts b/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts index 3c21e19ce..ff3254b1c 100644 --- a/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts +++ b/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts @@ -4,7 +4,7 @@ type OpenRelatedTablesLogEvent = { tableId: string } -export const OpenRelatedTablesLogEvent = ({ +export const openRelatedTablesLogEvent = ({ tableId, }: OpenRelatedTablesLogEvent) => { pushToDataLayer({ From 9eab8e0cccecd3c110dfd72ce65abc7aec7804cc Mon Sep 17 00:00:00 2001 From: "ryota.sasazawa" Date: Fri, 20 Dec 2024 09:40:12 +0900 Subject: [PATCH 4/4] fix: Rename event from 'open_related_tables' to 'openRelatedTables' --- .../src/features/gtm/utils/openRelatedTablesLogEvent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts b/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts index ff3254b1c..934fbb6e9 100644 --- a/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts +++ b/frontend/packages/erd-core/src/features/gtm/utils/openRelatedTablesLogEvent.ts @@ -8,7 +8,7 @@ export const openRelatedTablesLogEvent = ({ tableId, }: OpenRelatedTablesLogEvent) => { pushToDataLayer({ - event: 'open_related_tables', + event: 'openRelatedTables', tableId, }) }