Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/69161
Change subject: Split test: instrument edit events for standard editor interface
......................................................................
Split test: instrument edit events for standard editor interface
This change adds 'page-edit-impression', 'page-save-(attempt/success)',
and '(section-)edit-link-click' events to the standard (non-VE) editor
interface, mirroring the events we added to VE. This makes the event data
usable for split-test analysis.
Change-Id: I51c441d61daa18d58ca7f62a9e5f07902a099050
---
M VisualEditor.hooks.php
M VisualEditor.php
A modules/ve/init/mw/ve.init.mw.splitTest.js
3 files changed, 66 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/61/69161/1
diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 788e61c..45e9db6 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -61,6 +61,10 @@
$output->addModules( array( 'schema.Edit' ) );
}
$output->addModules( array(
'ext.visualEditor.viewPageTarget' ) );
+ } else {
+ if ( $wgVisualEditorEnableEventLogging ) {
+ $output->addModules( array( 'schema.Edit',
'ext.visualEditor.splitTest' ) );
+ }
}
return true;
}
diff --git a/VisualEditor.php b/VisualEditor.php
index a114c98..a5ccf33 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -91,6 +91,13 @@
'unicodejs/unicodejs.wordbreak.js',
),
),
+
+ // Added for 18-Jun-2013 split test; safe to remove after
+ 'ext.visualEditor.splitTest' => $wgVisualEditorResourceTemplate + array(
+ 'scripts' => array(
+ 've/init/mw/ve.init.mw.splitTest.js',
+ )
+ ),
// Alias for backwards compat, safe to remove after
'ext.visualEditor.editPageInit' => $wgVisualEditorResourceTemplate +
array(
'dependencies' => array(
diff --git a/modules/ve/init/mw/ve.init.mw.splitTest.js
b/modules/ve/init/mw/ve.init.mw.splitTest.js
new file mode 100644
index 0000000..592c6f0
--- /dev/null
+++ b/modules/ve/init/mw/ve.init.mw.splitTest.js
@@ -0,0 +1,55 @@
+/*global mediaWiki */
+( function ( mw, $ ) {
+ 'use strict';
+
+ if ( !mw.config.get( 'wgVisualEditorConfig', {} ).enableEventLogging ) {
+ return;
+ }
+
+ function log( action ) {
+ var dfd = $.Deferred();
+ setTimeout( dfd.reject, 1000 );
+ mw.loader.using( 'schema.Edit', function () {
+ mw.eventLog.logEvent( 'Edit', {
+ version: 0,
+ action: action,
+ editor: 'wikitext',
+ pageId: mw.config.get( 'wgArticleId' ),
+ pageNs: mw.config.get( 'wgNamespaceNumber' ),
+ pageName: mw.config.get( 'wgPageName' ),
+ pageViewSessionId:
mw.user.generateRandomSessionId(),
+ revId: mw.config.get( 'wgCurRevisionId' ),
+ userId: +mw.config.get( 'wgUserId' )
+ } ).always( dfd.resolve );
+ } );
+ return dfd;
+ }
+
+ mw.hook( 'postEdit' ).add( function () {
+ log( 'page-save-success' );
+ } );
+
+ if ( mw.config.get('wgAction') === 'edit' ) {
+ log( 'page-edit-impression' );
+ }
+
+ // Log clicks on page edit and section edit links
+ $( '#ca-edit a, .mw-editsection a' ).on( 'click', function ( e ) {
+ var href = this.href,
+ action = /section=/.test( href ) ?
'section-edit-link-click' : 'edit-link-click';
+ log( action ).always( function () {
+ window.location = href;
+ } );
+ e.preventDefault();
+ } );
+
+ // Log edit submit
+ $( '#wpSave' ).one( 'click', function ( e ) {
+ var $save = $( this );
+ log( 'page-save-attempt' ).always( function () {
+ $save.trigger( 'click' );
+ } );
+ e.preventDefault();
+ } );
+
+} ( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/69161
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I51c441d61daa18d58ca7f62a9e5f07902a099050
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits