Bucket the user's edit count before logging an event

Bug: T272569
Change-Id: I5313a3808b266bb60644b40bdb192db77208774a
This commit is contained in:
Andrew Kostka 2021-01-21 13:52:28 +01:00
parent 777ce7963d
commit d81226fdf7
2 changed files with 14 additions and 5 deletions

View file

@ -218,7 +218,7 @@
"attributes": {
"EventLogging": {
"Schemas": {
"TemplateDataEditor": 20759032,
"TemplateDataEditor": 20990386,
"TemplateDataApi": 20817949
}
},

View file

@ -1,6 +1,8 @@
function logEvent( eventName ) {
mw.track( 'event.TemplateDataEditor', {
/* eslint-disable camelcase */
var event, editCountBucket;
/* eslint-disable camelcase */
event = {
action: eventName,
page_id: mw.config.get( 'wgArticleId' ),
page_title: mw.config.get( 'wgPageName' ),
@ -8,8 +10,15 @@ function logEvent( eventName ) {
rev_id: mw.config.get( 'wgCurRevisionId' ),
user_edit_count: mw.config.get( 'wgUserEditCount', 0 ),
user_id: mw.user.getId()
/* eslint-enable camelcase */
} );
};
editCountBucket = mw.config.get( 'wgUserEditCountBucket' );
if ( editCountBucket !== null ) {
event.user_edit_count_bucket = editCountBucket;
}
/* eslint-enable camelcase */
mw.track( 'event.TemplateDataEditor', event );
}
module.exports = {