Inchikutty has uploaded a new change for review.

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

Change subject: Basic funnel data logging for UploadWizard
......................................................................

Basic funnel data logging for UploadWizard

See also https://meta.wikimedia.org/wiki/Schema:UploadWizardStep

Change-Id: Ifc79d45617f1712ad937373cd51592bfea645e4c
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/609
---
M UploadWizard.php
M UploadWizardHooks.php
M resources/mw.UploadWizard.js
A tests/qunit/mw.UploadWizard.test.js
4 files changed, 45 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/13/141213/1

diff --git a/UploadWizard.php b/UploadWizard.php
index db9d8da..410062a 100644
--- a/UploadWizard.php
+++ b/UploadWizard.php
@@ -134,6 +134,8 @@
        'position' => 'top'
 ) + $uploadWizardModuleInfo;
 
+$wgEventLoggingSchemas[ 'UploadWizardStep' ] = 8612364;
+
 // Campaign hook handlers
 $wgHooks[ 'BeforePageDisplay' ][] = 'CampaignHooks::onBeforePageDisplay';
 $wgHooks[ 'EditFilterMerged' ][] = 'CampaignHooks::onEditFilterMerged';
diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index c6fd786..e416e17 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -517,6 +517,9 @@
                                'ext.eventLogging',
                                'schema.UploadWizardTutorialActions',
                        );
+
+                       self::$modules['ext.uploadWizard']['dependencies'][] = 
'schema.UploadWizardStep';
+
                }
 
                foreach ( self::$modules as $name => $resources ) {
@@ -674,6 +677,7 @@
        public static function onResourceLoaderTestModules( array 
&$testModules, ResourceLoader &$resourceLoader ) {
                $testModules['qunit']['ext.uploadWizard.unit.tests'] = array(
                        'scripts' => array(
+                               'tests/qunit/mw.UploadWizard.test.js',
                                
'tests/qunit/mw.UploadWizardLicenseInput.test.js',
                                'tests/qunit/mw.FlickrChecker.test.js',
                        ),
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index 9ecc0ca..14b452f 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -28,6 +28,11 @@
        this.makePreviewsFlag = true;
        this.showDeed = false;
 
+    /**
+     * A random number identifying this upload session for analytics purposes.
+     * @property {string}
+     */
+    this.flowId = parseInt( new Date().getTime() + '' + Math.floor( 
Math.random() * 1000 ), 10 );
 };
 
 mw.UploadWizard.DEBUG = true;
@@ -50,6 +55,7 @@
                $.purgeReadyEvents();
                $.purgeSubscriptions();
                this.removeMatchingUploads( function() { return true; } );
+        this.currentStepName = undefined;
        },
 
 
@@ -517,7 +523,14 @@
 
                $( '#mwe-upwiz-steps' ).arrowStepsHighlight( '#mwe-upwiz-step-' 
+ selectedStepName );
 
-               this.currentStepName = selectedStepName;
+        if ( mw.eventLog ) {
+            if ( selectedStepName === 'file' && !this.currentStepName ) { // 
tutorial was skipped
+                mw.eventLog.logEvent( 'UploadWizardStep', { flowId: 
this.flowId, step: 'tutorial', skipped: true } );
+            }
+            mw.eventLog.logEvent( 'UploadWizardStep', { flowId: this.flowId, 
step: selectedStepName } );
+        }
+
+        this.currentStepName = selectedStepName;
 
                if ( selectedStepName === 'file' ) {
                        this.resetFileStepUploads();
diff --git a/tests/qunit/mw.UploadWizard.test.js 
b/tests/qunit/mw.UploadWizard.test.js
new file mode 100644
index 0000000..4fc65f6
--- /dev/null
+++ b/tests/qunit/mw.UploadWizard.test.js
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the MediaWiki extension UploadWizard.
+ *
+ * UploadWizard is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * UploadWizard is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with UploadWizard.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+( function ( mw ) {
+    QUnit.module( 'mw.UploadWizard', QUnit.newMwEnvironment() );
+
+    QUnit.test( 'constructor sanity test', 1, function ( assert ) {
+        var wizard = new mw.UploadWizard( {} );
+        assert.ok( wizard );
+    } );
+}( mediaWiki, jQuery ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc79d45617f1712ad937373cd51592bfea645e4c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: osm
Gerrit-Owner: Inchikutty <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>

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

Reply via email to