Robmoen has uploaded a new change for review.

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

Change subject: Instrumentation of signup experiment schemas
......................................................................

Instrumentation of signup experiment schemas

Change-Id: I3d41ae2f6fc2ac684c8d1f1c7cc7cd9a07f5c9dc
---
M Hooks.php
M resources/ext.gettingstarted.anonymousEditorAcquisition.js
2 files changed, 33 insertions(+), 2 deletions(-)


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

diff --git a/Hooks.php b/Hooks.php
index 672c45c..b7635dc 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -134,9 +134,24 @@
         * intent to show some onboarding flow.
         */
        protected static function isPostCreateReturn( OutputPage $out ) {
-               return $out->getRequest()->getFuzzyBool( 
'gettingStartedReturn');
+               return $out->getRequest()->getFuzzyBool( 'gettingStartedReturn' 
);
        }
 
+       /**
+        * Called if isPostCreateReturn is true, checks to see if we acquired 
user
+        * through pre & post edit
+        */
+       protected static function isAccountCreationPreOrPostEdit( OutputPage 
$out ) {
+               return $out->getRequest()->getFuzzyBool( 'gsaa' );
+       }
+
+       /**
+        * Checks if the current page is user signup page.
+        */
+       protected static function isSignupPage( OutputPage $out ) {
+               $is_signup = $out->getRequest()->getText( 'type' ) == 'signup';
+               return $out->getTitle()->isSpecial( 'UserLogin' ) && $is_signup;
+       }
 
        /**
         * Adds the returnTo module to the  page the user returned to upon 
signup.
@@ -253,6 +268,15 @@
                }
 
                if ( self::isPostCreateReturn( $out ) ) {
+                       // Log server side event if we acquired the user through
+                       // pre or post edit call to action.
+                       if ( self::isAccountCreationPreOrPostEdit( $out ) ) {
+                               $event = array(
+                                       'token'  => $user->getToken(),
+                                       'userId' => $user->getId()
+                               );
+                               \EventLogging::logEvent( 
'SignupExpAccountCreationComplete', 8102589, $event );
+                       }
                        // TODO (mattflaschen, 2013-10-05): If we're not going 
to show
                        // anything, we probably shouldn't add this module for 
performance
                        // reasons.
@@ -263,6 +287,13 @@
                        self::addReturnToModules( $out, $skin );
                }
 
+               // Log server side event if user entered signup page through pre
+               // or post edit call to action
+               if( self::isSignupPage( $out ) && 
self::isAccountCreationPreOrPostEdit( $out ) ) {
+                       $event = array( 'token' => $user->getToken() );
+                       \EventLogging::logEvent( 
'SignupExpAccountCreationImpression', 8102591, $event );
+               }
+
                if ( $wgGettingStartedRunTest && $user->isAnon() ) {
                        $out->addModules( array(
                                'ext.gettingstarted.anonymousEditorAcquisition',
diff --git a/resources/ext.gettingstarted.anonymousEditorAcquisition.js 
b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
index 72e47d8..a0d73fb 100644
--- a/resources/ext.gettingstarted.anonymousEditorAcquisition.js
+++ b/resources/ext.gettingstarted.anonymousEditorAcquisition.js
@@ -254,7 +254,7 @@
                                window.location.href = new mw.Title( 
'Special:UserLogin' ).getUrl( {
                                        type: 'signup',
                                        returnto: mw.config.get( 'wgPageName' ),
-                                       returntoquery: uri.getQueryString()
+                                       returntoquery: uri.getQueryString() + 
'&gsaa=true'
                                } );
                        } );
                },

-- 
To view, visit https://gerrit.wikimedia.org/r/132486
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d41ae2f6fc2ac684c8d1f1c7cc7cd9a07f5c9dc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GettingStarted
Gerrit-Branch: master
Gerrit-Owner: Robmoen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to