feat(editor): add block creation tracking (#10294)

fix: PD-2090
This commit is contained in:
zzj3720
2025-02-20 02:25:28 +00:00
parent a0e3f9909c
commit ba91b36cc3
3 changed files with 19 additions and 4 deletions

View File

@@ -274,6 +274,15 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
place: 'after',
removeEmptyLine: true,
})
.pipe(({ insertedTableBlockId }) => {
if (insertedTableBlockId) {
const telemetry =
rootComponent.std.getOptional(TelemetryProvider);
telemetry?.track('BlockCreated', {
blockType: 'affine:table',
});
}
})
.run();
},
},
@@ -612,8 +621,8 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
if (insertedDatabaseBlockId) {
const telemetry =
rootComponent.std.getOptional(TelemetryProvider);
telemetry?.track('AddDatabase', {
blockId: insertedDatabaseBlockId,
telemetry?.track('BlockCreated', {
blockType: 'affine:database',
});
}
})
@@ -675,8 +684,8 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
if (insertedDatabaseBlockId) {
const telemetry =
rootComponent.std.getOptional(TelemetryProvider);
telemetry?.track('AddDatabase', {
blockId: insertedDatabaseBlockId,
telemetry?.track('BlockCreated', {
blockType: 'affine:database',
});
}
})