mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
chore(editor): add telemetry for note, embed doc and linked doc (#12234)
Close [BS-3480](https://linear.app/affine-design/issue/BS-3480/event-tracking) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added telemetry tracking to toolbar actions for embedding documents, duplicating notes, and toggling note display modes. - Telemetry events now track when new note blocks are created from drag-and-drop actions on the whiteboard. - **Chores** - Improved event tracking for user interactions to enhance analytics and usage insights. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -317,6 +317,15 @@ const builtinSurfaceToolbarConfig = {
|
|||||||
parentModel: lastVisibleNote,
|
parentModel: lastVisibleNote,
|
||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
|
ctx.track('BlockCreated', {
|
||||||
|
page: 'whiteboard editor',
|
||||||
|
module: 'toolbar',
|
||||||
|
segment: 'toolbar',
|
||||||
|
blockType: 'affine:embed-linked-doc',
|
||||||
|
control: 'toolbar:general',
|
||||||
|
other: 'insert to page',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -412,6 +421,15 @@ const builtinSurfaceToolbarConfig = {
|
|||||||
return next();
|
return next();
|
||||||
})
|
})
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
|
ctx.track('CanvasElementAdded', {
|
||||||
|
page: 'whiteboard editor',
|
||||||
|
type: 'note',
|
||||||
|
module: 'toolbar',
|
||||||
|
segment: 'toolbar',
|
||||||
|
control: 'conversation',
|
||||||
|
other: 'duplicate as note',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
captionAction,
|
captionAction,
|
||||||
|
|||||||
@@ -90,6 +90,15 @@ const builtinSurfaceToolbarConfig = {
|
|||||||
? NoteDisplayMode.DocAndEdgeless
|
? NoteDisplayMode.DocAndEdgeless
|
||||||
: NoteDisplayMode.EdgelessOnly;
|
: NoteDisplayMode.EdgelessOnly;
|
||||||
setDisplayMode(ctx, firstModel, newMode);
|
setDisplayMode(ctx, firstModel, newMode);
|
||||||
|
|
||||||
|
ctx.track('BlockCreated', {
|
||||||
|
page: 'whiteboard editor',
|
||||||
|
module: 'toolbar',
|
||||||
|
segment: 'toolbar',
|
||||||
|
blockType: 'affine:note',
|
||||||
|
control: 'toolbar:general',
|
||||||
|
other: `display in page: ${newMode === NoteDisplayMode.EdgelessOnly ? 'off' : 'on'}`,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1268,7 +1268,19 @@ export class DragEventWatcher {
|
|||||||
content,
|
content,
|
||||||
},
|
},
|
||||||
noteId
|
noteId
|
||||||
).catch(console.error);
|
)
|
||||||
|
.then(() => {
|
||||||
|
const telemetry = this.std.getOptional(TelemetryProvider);
|
||||||
|
telemetry?.track('CanvasElementAdded', {
|
||||||
|
page: 'whiteboard editor',
|
||||||
|
module: 'canvas',
|
||||||
|
segment: 'whiteboard',
|
||||||
|
control: 'canvas:drop',
|
||||||
|
type: 'note',
|
||||||
|
other: 'split-from-note',
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(console.error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user