[MediaWiki-commits] [Gerrit] Instrument the SignupExpCTAButtonClick schema - change (mediawiki...GettingStarted)

2014-05-19 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Instrument the SignupExpCTAButtonClick schema
..


Instrument the SignupExpCTAButtonClick schema

Also fix a bug in #handleNoThanksForVisualEditor where a second
SignupExpPageLinkClick event would be logged without the user
clicking Edit or Edit source.

Change-Id: I6a2b1fdfde1034daa5ee99e136a054a6af329422
(cherry picked from commit c099f868bc7cea83150a1a206efdc901df8ac7f2)
---
M GettingStarted.php
M resources/ext.gettingstarted.anonymousEditorAcquisition.js
M resources/tours/anonymouseditoracquisitionpostedit.js
M resources/tours/anonymouseditoracquisitionpreedit.js
M resources/tours/anonymouseditoracquisitionpreeditve.js
5 files changed, 147 insertions(+), 26 deletions(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/GettingStarted.php b/GettingStarted.php
index 166de2c..9bc9e3b 100644
--- a/GettingStarted.php
+++ b/GettingStarted.php
@@ -294,6 +294,7 @@
'mediawiki.Uri',
'ext.gettingstarted.user',
'schema.SignupExpPageLinkClick',
+   'schema.SignupExpCTAButtonClick',
'ext.guidedTour.lib',
'jquery.jStorage',
),
@@ -320,6 +321,12 @@
'revision' => 8101716
 );
 
+$wgResourceModules[ 'schema.SignupExpCTAButtonClick' ] = array(
+   'class'=> 'ResourceLoaderSchemaModule',
+   'schema'   => 'SignupExpCTAButtonClick',
+   'revision' => 8102619
+);
+
 $wgResourceModules[ 'ext.gettingstarted.assignToken' ] = array(
'scripts' => 'ext.gettingstarted.assignToken.js',
'dependencies' => array(
diff --git a/resources/ext.gettingstarted.anonymousEditorAcquisition.js 
b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
index c95dec2..72e47d8 100644
--- a/resources/ext.gettingstarted.anonymousEditorAcquisition.js
+++ b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
@@ -6,7 +6,7 @@
user = mw.gettingStarted.user,
token = user.getToken(),
bucket = user.getBucket(),
-   LOG_LINK_CLICK_DELAY = 500, // (ms)
+   LOG_EVENT_TIMEOUT = 500, // (ms)
tourToSelectorMapping = {
'anonymouseditoracquisitionpreedit': [ '#ca-edit', 
'.mw-editsection a:not( .mw-editsection-visualeditor )' ],
'anonymouseditoracquisitionpreeditve': [ '#ca-ve-edit', 
'.mw-editsection-visualeditor ' ]
@@ -17,7 +17,22 @@
isViewPage = (
mw.config.get( 'wgIsArticle' ) &&
!( 'diff' in currentUri.query )
-   );
+   ),
+   namespace = mw.config.get( 'wgNamespaceNumber' ),
+   self,
+   isLinkClickLoggingDisabled = false;
+
+   // NOTE (phuedx, 2014/05/07): This function provides a consistent, 
internal API for logging
+   // events.
+   //
+   // Ideally the EventLogging API should provide an equivalent of 
`logEventOrTimeout`.
+   // However, there are currently concerns about the approach [0].
+   //
+   // [0] https://bugzilla.wikimedia.org/show_bug.cgi?id=52287
+   function logEvent( schemaName, eventInstance ) {
+   return mw.eventLog.logEvent( schemaName, eventInstance );
+   }
+
 
/**
 * Registers a click listener on links corresponding to one or more 
selectors.
@@ -26,8 +41,7 @@
 * If `shouldDelay` is false, it will allow the normal link navigation 
to work.
 *
 * If `shouldDelay` is true, it will prevent normal navigation and wait 
for logging.  When
-* logging completes, or after a LOG_LINK_CLICK_DELAY-millisecond 
timeout, it will navigate
-* then.
+* logging completes, or after a 500 millisecond timeout, it will 
navigate then.
 *
 * @private
 *
@@ -45,27 +59,57 @@
}
 
$( selectors ).click( function ( event ) {
-   var logEventPromise, dfd;
+   var schemaName, eventInstance;
 
-   logEventPromise = mw.eventLog.logEvent( 
'SignupExpPageLinkClick', {
+   if ( isLinkClickLoggingDisabled ) {
+   return;
+   }
+
+   schemaName = 'SignupExpPageLinkClick';
+   eventInstance = {
token: token,
bucket: bucket,
link: link,
-   namespace: mw.config.get( 'wgNamespaceNumber' )
-   } );
+   namespace: namespace
+   };
 
if ( shouldDelay ) {
event.preventDefault();
 
-   d

[MediaWiki-commits] [Gerrit] Instrument the SignupExpCTAButtonClick schema - change (mediawiki...GettingStarted)

2014-05-15 Thread Phuedx (Code Review)
Phuedx has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/133457

Change subject: Instrument the SignupExpCTAButtonClick schema
..

Instrument the SignupExpCTAButtonClick schema

Also fix a bug in #handleNoThanksForVisualEditor where a second
SignupExpPageLinkClick event would be logged without the user
clicking Edit or Edit source.

Change-Id: I6a2b1fdfde1034daa5ee99e136a054a6af329422
(cherry picked from commit c099f868bc7cea83150a1a206efdc901df8ac7f2)
---
M GettingStarted.php
M resources/ext.gettingstarted.anonymousEditorAcquisition.js
M resources/tours/anonymouseditoracquisitionpostedit.js
M resources/tours/anonymouseditoracquisitionpreedit.js
M resources/tours/anonymouseditoracquisitionpreeditve.js
5 files changed, 147 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GettingStarted 
refs/changes/57/133457/1

diff --git a/GettingStarted.php b/GettingStarted.php
index 005de1f..e404772 100644
--- a/GettingStarted.php
+++ b/GettingStarted.php
@@ -294,6 +294,7 @@
'mediawiki.Uri',
'ext.gettingstarted.user',
'schema.SignupExpPageLinkClick',
+   'schema.SignupExpCTAButtonClick',
'ext.guidedTour.lib',
),
'messages' => array(
@@ -319,6 +320,12 @@
'revision' => 8101716
 );
 
+$wgResourceModules[ 'schema.SignupExpCTAButtonClick' ] = array(
+   'class'=> 'ResourceLoaderSchemaModule',
+   'schema'   => 'SignupExpCTAButtonClick',
+   'revision' => 8102619
+);
+
 $wgResourceModules[ 'ext.gettingstarted.assignToken' ] = array(
'scripts' => 'ext.gettingstarted.assignToken.js',
'dependencies' => array(
diff --git a/resources/ext.gettingstarted.anonymousEditorAcquisition.js 
b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
index 9c070e2..dea2e9f 100644
--- a/resources/ext.gettingstarted.anonymousEditorAcquisition.js
+++ b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
@@ -6,7 +6,7 @@
user = mw.gettingStarted.user,
token = user.getToken(),
bucket = user.getBucket(),
-   LOG_LINK_CLICK_DELAY = 500, // (ms)
+   LOG_EVENT_TIMEOUT = 500, // (ms)
tourToSelectorMapping = {
'anonymouseditoracquisitionpreedit': [ '#ca-edit', 
'.mw-editsection a:not( .mw-editsection-visualeditor )' ],
'anonymouseditoracquisitionpreeditve': [ '#ca-ve-edit', 
'.mw-editsection-visualeditor ' ]
@@ -17,7 +17,22 @@
isViewPage = (
mw.config.get( 'wgIsArticle' ) &&
!( 'diff' in currentUri.query )
-   );
+   ),
+   namespace = mw.config.get( 'wgNamespaceNumber' ),
+   self,
+   isLinkClickLoggingDisabled = false;
+
+   // NOTE (phuedx, 2014/05/07): This function provides a consistent, 
internal API for logging
+   // events.
+   //
+   // Ideally the EventLogging API should provide an equivalent of 
`logEventOrTimeout`.
+   // However, there are currently concerns about the approach [0].
+   //
+   // [0] https://bugzilla.wikimedia.org/show_bug.cgi?id=52287
+   function logEvent( schemaName, eventInstance ) {
+   return mw.eventLog.logEvent( schemaName, eventInstance );
+   }
+
 
/**
 * Registers a click listener on links corresponding to one or more 
selectors.
@@ -26,8 +41,7 @@
 * If `shouldDelay` is false, it will allow the normal link navigation 
to work.
 *
 * If `shouldDelay` is true, it will prevent normal navigation and wait 
for logging.  When
-* logging completes, or after a LOG_LINK_CLICK_DELAY-millisecond 
timeout, it will navigate
-* then.
+* logging completes, or after a 500 millisecond timeout, it will 
navigate then.
 *
 * @private
 *
@@ -45,27 +59,57 @@
}
 
$( selectors ).click( function ( event ) {
-   var logEventPromise, dfd;
+   var schemaName, eventInstance;
 
-   logEventPromise = mw.eventLog.logEvent( 
'SignupExpPageLinkClick', {
+   if ( isLinkClickLoggingDisabled ) {
+   return;
+   }
+
+   schemaName = 'SignupExpPageLinkClick';
+   eventInstance = {
token: token,
bucket: bucket,
link: link,
-   namespace: mw.config.get( 'wgNamespaceNumber' )
-   } );
+   namespace: namespace
+   };
 
if ( shouldDelay ) {
event.prev

[MediaWiki-commits] [Gerrit] Instrument the SignupExpCTAButtonClick schema - change (mediawiki...GettingStarted)

2014-05-09 Thread Robmoen (Code Review)
Robmoen has submitted this change and it was merged.

Change subject: Instrument the SignupExpCTAButtonClick schema
..


Instrument the SignupExpCTAButtonClick schema

Also fix a bug in #handleNoThanksForVisualEditor where a second
SignupExpPageLinkClick event would be logged without the user
clicking Edit or Edit source.

Change-Id: I6a2b1fdfde1034daa5ee99e136a054a6af329422
---
M GettingStarted.php
M resources/ext.gettingstarted.anonymousEditorAcquisition.js
M resources/tours/anonymouseditoracquisitionpostedit.js
M resources/tours/anonymouseditoracquisitionpreedit.js
M resources/tours/anonymouseditoracquisitionpreeditve.js
5 files changed, 147 insertions(+), 26 deletions(-)

Approvals:
  Robmoen: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/GettingStarted.php b/GettingStarted.php
index 005de1f..e404772 100644
--- a/GettingStarted.php
+++ b/GettingStarted.php
@@ -294,6 +294,7 @@
'mediawiki.Uri',
'ext.gettingstarted.user',
'schema.SignupExpPageLinkClick',
+   'schema.SignupExpCTAButtonClick',
'ext.guidedTour.lib',
),
'messages' => array(
@@ -319,6 +320,12 @@
'revision' => 8101716
 );
 
+$wgResourceModules[ 'schema.SignupExpCTAButtonClick' ] = array(
+   'class'=> 'ResourceLoaderSchemaModule',
+   'schema'   => 'SignupExpCTAButtonClick',
+   'revision' => 8102619
+);
+
 $wgResourceModules[ 'ext.gettingstarted.assignToken' ] = array(
'scripts' => 'ext.gettingstarted.assignToken.js',
'dependencies' => array(
diff --git a/resources/ext.gettingstarted.anonymousEditorAcquisition.js 
b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
index 9c070e2..dea2e9f 100644
--- a/resources/ext.gettingstarted.anonymousEditorAcquisition.js
+++ b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
@@ -6,7 +6,7 @@
user = mw.gettingStarted.user,
token = user.getToken(),
bucket = user.getBucket(),
-   LOG_LINK_CLICK_DELAY = 500, // (ms)
+   LOG_EVENT_TIMEOUT = 500, // (ms)
tourToSelectorMapping = {
'anonymouseditoracquisitionpreedit': [ '#ca-edit', 
'.mw-editsection a:not( .mw-editsection-visualeditor )' ],
'anonymouseditoracquisitionpreeditve': [ '#ca-ve-edit', 
'.mw-editsection-visualeditor ' ]
@@ -17,7 +17,22 @@
isViewPage = (
mw.config.get( 'wgIsArticle' ) &&
!( 'diff' in currentUri.query )
-   );
+   ),
+   namespace = mw.config.get( 'wgNamespaceNumber' ),
+   self,
+   isLinkClickLoggingDisabled = false;
+
+   // NOTE (phuedx, 2014/05/07): This function provides a consistent, 
internal API for logging
+   // events.
+   //
+   // Ideally the EventLogging API should provide an equivalent of 
`logEventOrTimeout`.
+   // However, there are currently concerns about the approach [0].
+   //
+   // [0] https://bugzilla.wikimedia.org/show_bug.cgi?id=52287
+   function logEvent( schemaName, eventInstance ) {
+   return mw.eventLog.logEvent( schemaName, eventInstance );
+   }
+
 
/**
 * Registers a click listener on links corresponding to one or more 
selectors.
@@ -26,8 +41,7 @@
 * If `shouldDelay` is false, it will allow the normal link navigation 
to work.
 *
 * If `shouldDelay` is true, it will prevent normal navigation and wait 
for logging.  When
-* logging completes, or after a LOG_LINK_CLICK_DELAY-millisecond 
timeout, it will navigate
-* then.
+* logging completes, or after a 500 millisecond timeout, it will 
navigate then.
 *
 * @private
 *
@@ -45,27 +59,57 @@
}
 
$( selectors ).click( function ( event ) {
-   var logEventPromise, dfd;
+   var schemaName, eventInstance;
 
-   logEventPromise = mw.eventLog.logEvent( 
'SignupExpPageLinkClick', {
+   if ( isLinkClickLoggingDisabled ) {
+   return;
+   }
+
+   schemaName = 'SignupExpPageLinkClick';
+   eventInstance = {
token: token,
bucket: bucket,
link: link,
-   namespace: mw.config.get( 'wgNamespaceNumber' )
-   } );
+   namespace: namespace
+   };
 
if ( shouldDelay ) {
event.preventDefault();
 
-   dfd = $.Deferred();
-   dfd.always( function () 

[MediaWiki-commits] [Gerrit] Instrument the SignupExpCTAButtonClick schema - change (mediawiki...GettingStarted)

2014-05-08 Thread Phuedx (Code Review)
Phuedx has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/132220

Change subject: Instrument the SignupExpCTAButtonClick schema
..

Instrument the SignupExpCTAButtonClick schema

Change-Id: I6a2b1fdfde1034daa5ee99e136a054a6af329422
---
M GettingStarted.php
M resources/ext.gettingstarted.anonymousEditorAcquisition.js
M resources/tours/anonymouseditoracquisitionpostedit.js
M resources/tours/anonymouseditoracquisitionpreedit.js
M resources/tours/anonymouseditoracquisitionpreeditve.js
5 files changed, 134 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GettingStarted 
refs/changes/20/132220/1

diff --git a/GettingStarted.php b/GettingStarted.php
index 005de1f..e404772 100644
--- a/GettingStarted.php
+++ b/GettingStarted.php
@@ -294,6 +294,7 @@
'mediawiki.Uri',
'ext.gettingstarted.user',
'schema.SignupExpPageLinkClick',
+   'schema.SignupExpCTAButtonClick',
'ext.guidedTour.lib',
),
'messages' => array(
@@ -319,6 +320,12 @@
'revision' => 8101716
 );
 
+$wgResourceModules[ 'schema.SignupExpCTAButtonClick' ] = array(
+   'class'=> 'ResourceLoaderSchemaModule',
+   'schema'   => 'SignupExpCTAButtonClick',
+   'revision' => 8102619
+);
+
 $wgResourceModules[ 'ext.gettingstarted.assignToken' ] = array(
'scripts' => 'ext.gettingstarted.assignToken.js',
'dependencies' => array(
diff --git a/resources/ext.gettingstarted.anonymousEditorAcquisition.js 
b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
index 9c070e2..d66c707 100644
--- a/resources/ext.gettingstarted.anonymousEditorAcquisition.js
+++ b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
@@ -6,7 +6,7 @@
user = mw.gettingStarted.user,
token = user.getToken(),
bucket = user.getBucket(),
-   LOG_LINK_CLICK_DELAY = 500, // (ms)
+   LOG_EVENT_TIMEOUT = 500, // (ms)
tourToSelectorMapping = {
'anonymouseditoracquisitionpreedit': [ '#ca-edit', 
'.mw-editsection a:not( .mw-editsection-visualeditor )' ],
'anonymouseditoracquisitionpreeditve': [ '#ca-ve-edit', 
'.mw-editsection-visualeditor ' ]
@@ -17,7 +17,21 @@
isViewPage = (
mw.config.get( 'wgIsArticle' ) &&
!( 'diff' in currentUri.query )
-   );
+   ),
+   namespace = mw.config.get( 'wgNamespaceNumber' ),
+   self;
+
+   // NOTE (phuedx, 2014/05/07): This function provides a consistent, 
internal API for logging
+   // events.
+   //
+   // Ideally the EventLogging API should provide an equivalent of 
`logEventOrTimeout`.
+   // However, there are currently concerns about the approach [0].
+   //
+   // [0] https://bugzilla.wikimedia.org/show_bug.cgi?id=52287
+   function logEvent( schemaName, eventInstance ) {
+   return mw.eventLog.logEvent( schemaName, eventInstance );
+   }
+
 
/**
 * Registers a click listener on links corresponding to one or more 
selectors.
@@ -26,8 +40,7 @@
 * If `shouldDelay` is false, it will allow the normal link navigation 
to work.
 *
 * If `shouldDelay` is true, it will prevent normal navigation and wait 
for logging.  When
-* logging completes, or after a LOG_LINK_CLICK_DELAY-millisecond 
timeout, it will navigate
-* then.
+* logging completes, or after a 500 millisecond timeout, it will 
navigate then.
 *
 * @private
 *
@@ -45,27 +58,53 @@
}
 
$( selectors ).click( function ( event ) {
-   var logEventPromise, dfd;
+   var schemaName, eventInstance;
 
-   logEventPromise = mw.eventLog.logEvent( 
'SignupExpPageLinkClick', {
+   schemaName = 'SignupExpPageLinkClick';
+   eventInstance = {
token: token,
bucket: bucket,
link: link,
-   namespace: mw.config.get( 'wgNamespaceNumber' )
-   } );
+   namespace: namespace
+   };
 
if ( shouldDelay ) {
event.preventDefault();
 
-   dfd = $.Deferred();
-   dfd.always( function () {
+   logEventOrTimeout( schemaName, eventInstance 
).always( function () {
window.location.href = 
getHrefFromTarget( $( event.currentTarget ) );
} );
-
-