r81358 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81357‎ | r81358 | r81359 >
Date:23:46, 1 February 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Added click tracking to pitches.
Modified paths:
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js
@@ -36,6 +36,15 @@
3737 $.cookie( 'ext.articleFeedback.pitches.' + pitch, 'hide', { 'expires': durration } );
3838 }
3939
 40+function trackClick( id ) {
 41+ // Track the click so we can figure out how useful this is
 42+ if ( typeof $.trackActionWithInfo == 'function' ) {
 43+ $.trackActionWithInfo(
 44+ 'articlefeedback-' + id, mediaWiki.config.get( 'wgTitle' )
 45+ )
 46+ }
 47+}
 48+
4049 /**
4150 * Survey object
4251 *
@@ -202,6 +211,8 @@
203212 },
204213 'action': function() {
205214 survey.load();
 215+ // Click tracking
 216+ trackClick( 'pitch-survey' );
206217 // Hide the pitch immediately
207218 return true;
208219 },
@@ -217,6 +228,8 @@
218229 ? lottery( 0.5 ) : false;
219230 },
220231 'action': function() {
 232+ // Click tracking
 233+ trackClick( 'pitch-join-signup' );
221234 // Go to account creation page
222235 window.location =
223236 mediaWiki.config.get( 'wgScript' ) + '?' + $.param( {
@@ -235,6 +248,8 @@
236249 // Special alternative action for going to login page
237250 'altAccept': 'articlefeedback-pitch-join-login',
238251 'altAction': function() {
 252+ // Click tracking
 253+ trackClick( 'pitch-join-login' );
239254 // Go to login page
240255 window.location =
241256 mediaWiki.config.get( 'wgScript' ) + '?' + $.param( {
@@ -263,6 +278,8 @@
264279 return !isPitchMuted( 'edit' );
265280 },
266281 'action': function() {
 282+ // Click tracking
 283+ trackClick( 'pitch-edit' );
267284 // Go to edit page
268285 window.location =
269286 mediaWiki.config.get( 'wgScript' ) + '?' + $.param( {
@@ -290,10 +307,8 @@
291308 .find( '#t-articlefeedback a' )
292309 .text( mw.msg( 'articlefeedback-form-switch-label' ) )
293310 .click( function() {
294 - // Track the click so we can figure out how useful this is
295 - if ( typeof $.trackActionWithInfo == 'function' ) {
296 - $.trackActionWithInfo( 'articlefeedback-toolbox-link', mediaWiki.config.get( 'wgTitle' ) )
297 - }
 311+ // Click tracking
 312+ trackClick( 'toolbox-link' );
298313 // Get the image, set the count and an interval.
299314 var $box = $( '#mw-articlefeedback' );
300315 var count = 0;

Status & tagging log