diff --git a/frontend/.changeset/dry-islands-flash.md b/frontend/.changeset/dry-islands-flash.md new file mode 100644 index 00000000..45e9bdca --- /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 0dc6e856..42e9d017 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 (
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 bd571fa8..4d428a4c 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 00000000..934fbb6e --- /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: 'openRelatedTables', + tableId, + }) +}