@@ -48,6 +48,20 @@ define(function (require, exports, module) {
4848 // metric tells us "users who edit at least one md doc" without
4949 // inflating with every keystroke.
5050 const _mdEditedFiles = new Set ( ) ;
51+
52+ // Session-cumulative edit-batch count for distinguishing light vs
53+ // heavy markdown editors. Each iframe content change (already
54+ // 50ms-debounced upstream) increments this. When the count crosses
55+ // a bucket threshold we fire a one-shot count event so the analytics
56+ // funnel reads as: users-with-LTE5 ⊇ LTE25 ⊇ LTE100 ⊇ GT500.
57+ let _mdEditCount = 0 ;
58+ const MD_EDIT_BUCKETS = [
59+ { threshold : 5 , label : "LTE5" } ,
60+ { threshold : 25 , label : "LTE25" } ,
61+ { threshold : 100 , label : "LTE100" } ,
62+ { threshold : 500 , label : "GT500" }
63+ ] ;
64+
5165 let _active = false ;
5266 let _doc = null ;
5367 let _$iframe = null ;
@@ -675,6 +689,18 @@ define(function (require, exports, module) {
675689 Metrics . countEvent ( Metrics . EVENT_TYPE . MD , "doc" , "edited" ) ;
676690 }
677691
692+ // Edit-volume bucket: fire once when the cumulative session
693+ // edit count first crosses each threshold. Each bucket fires
694+ // at most once per session, so the metric reads as a funnel.
695+ _mdEditCount ++ ;
696+ for ( let i = 0 ; i < MD_EDIT_BUCKETS . length ; i ++ ) {
697+ if ( _mdEditCount === MD_EDIT_BUCKETS [ i ] . threshold ) {
698+ Metrics . countEvent ( Metrics . EVENT_TYPE . MD ,
699+ "edits" , MD_EDIT_BUCKETS [ i ] . label ) ;
700+ break ;
701+ }
702+ }
703+
678704 // Send back the actual CM text so the iframe can compute accurate
679705 // data-source-line attributes. The markdown from convertToMarkdown
680706 // may differ slightly from CM's content (e.g. table formatting),
0 commit comments