r108701 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108700‎ | r108701 | r108702 >
Date:00:18, 12 January 2012
Author:rsterbin
Status:ok
Tags:
Comment:
Bug fix: incorrect impressions on form load in
modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js:
- Updated load():
- to accept a second argument "from" so that the location can be passed in,
- to allow "auto" as the first argument (what to display),
- and to pass "from" on to showForm() and showCTA()
- Updated showForm() and showCTA() to accept "from" as an argument, and to
use that for the tracking id
- Updated both uses of load(), and the use of showCTA() on success, to send
the new arguments
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -2030,7 +2030,7 @@
20312031 // When the tool is visible, load the form
20322032 $.articleFeedbackv5.$holder.appear( function () {
20332033 if ( !$.articleFeedbackv5.isLoaded ) {
2034 - $.articleFeedbackv5.load();
 2034+ $.articleFeedbackv5.load( 'auto', 'bottom' );
20352035 }
20362036 } );
20372037 // Keep track of links that must be removed after a successful submission
@@ -2321,11 +2321,12 @@
23222322 /**
23232323 * Loads the tool onto the page
23242324 *
2325 - * @param display string "form" or "cta"
 2325+ * @param display string what to load ("form", "cta", or "auto")
 2326+ * @param from string from whence came the request ("bottom" or "overlay")
23262327 */
2327 - $.articleFeedbackv5.load = function ( display ) {
 2328+ $.articleFeedbackv5.load = function ( display, from ) {
23282329
2329 - if ( display ) {
 2330+ if ( display && 'auto' != display ) {
23302331 $.articleFeedbackv5.toDisplay = ( display == 'cta' ? 'cta' : 'form' );
23312332 }
23322333
@@ -2339,7 +2340,7 @@
23402341 return;
23412342 }
23422343 $.articleFeedbackv5.loadContainers();
2343 - $.articleFeedbackv5.showForm();
 2344+ $.articleFeedbackv5.showForm( from );
23442345 }
23452346
23462347 else if ( 'cta' == $.articleFeedbackv5.toDisplay ) {
@@ -2349,7 +2350,7 @@
23502351 return;
23512352 }
23522353 $.articleFeedbackv5.loadContainers();
2353 - $.articleFeedbackv5.showCTA();
 2354+ $.articleFeedbackv5.showCTA( from );
23542355 }
23552356
23562357 $.articleFeedbackv5.isLoaded = true;
@@ -2431,8 +2432,10 @@
24322433
24332434 /**
24342435 * Builds the form and loads it into the document
 2436+ *
 2437+ * @param from string from whence came the request ("bottom" or "overlay")
24352438 */
2436 - $.articleFeedbackv5.showForm = function () {
 2439+ $.articleFeedbackv5.showForm = function ( from ) {
24372440
24382441 // Build the form
24392442 var bucket = $.articleFeedbackv5.currentBucket();
@@ -2467,11 +2470,7 @@
24682471 }
24692472
24702473 // Track the event
2471 - if ( $.articleFeedbackv5.inDialog ) {
2472 - $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-impression-overlay' );
2473 - } else {
2474 - $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-impression-bottom' );
2475 - }
 2474+ $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-impression-' + from );
24762475
24772476 $.articleFeedbackv5.nowShowing = 'form';
24782477 };
@@ -2537,7 +2536,7 @@
25382537 $.articleFeedbackv5.feedbackId = data.articlefeedbackv5.feedback_id;
25392538 $.articleFeedbackv5.selectCTA( data.articlefeedbackv5.cta_id );
25402539 $.articleFeedbackv5.unlockForm();
2541 - $.articleFeedbackv5.showCTA();
 2540+ $.articleFeedbackv5.showCTA( $.articleFeedbackv5.inDialog ? 'overlay' : 'bottom' );
25422541 // Drop a cookie for a successful submit
25432542 $.cookie( $.articleFeedbackv5.prefix( 'submitted' ), 'true', { 'expires': 365, 'path': '/' } );
25442543 // Clear out anything that needs removing (usually feedback links)
@@ -2603,8 +2602,10 @@
26042603
26052604 /**
26062605 * Shows a CTA
 2606+ *
 2607+ * @param from string from whence came the request ("bottom" or "overlay")
26072608 */
2608 - $.articleFeedbackv5.showCTA = function () {
 2609+ $.articleFeedbackv5.showCTA = function ( from ) {
26092610
26102611 // Build the cta
26112612 var cta = $.articleFeedbackv5.currentCTA();
@@ -2668,8 +2669,7 @@
26692670
26702671 // Track the event
26712672 $.articleFeedbackv5.trackClick( $.articleFeedbackv5.bucketName() + '-' +
2672 - $.articleFeedbackv5.ctaName() + '-impression-' +
2673 - ( $.articleFeedbackv5.inDialog ? 'overlay' : 'bottom' ) );
 2673+ $.articleFeedbackv5.ctaName() + '-impression-' + from );
26742674
26752675 $.articleFeedbackv5.nowShowing = 'cta';
26762676 };
@@ -2896,7 +2896,7 @@
28972897 // $.articleFeedbackv5.clear();
28982898 }
28992899 if ( !$.articleFeedbackv5.isLoaded ) {
2900 - $.articleFeedbackv5.load();
 2900+ $.articleFeedbackv5.load( 'auto', 'overlay' );
29012901 }
29022902 if ( !$.articleFeedbackv5.inDialog ) {
29032903 $.articleFeedbackv5.setDialogDimensions();

Follow-up revisions

RevisionCommit summaryAuthorDate
r109186MFT r108701reedy19:20, 17 January 2012

Status & tagging log