Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.js |
— | — | @@ -36,6 +36,15 @@ |
37 | 37 | $.cookie( 'ext.articleFeedback.pitches.' + pitch, 'hide', { 'expires': durration } ); |
38 | 38 | } |
39 | 39 | |
| 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 | + |
40 | 49 | /** |
41 | 50 | * Survey object |
42 | 51 | * |
— | — | @@ -202,6 +211,8 @@ |
203 | 212 | }, |
204 | 213 | 'action': function() { |
205 | 214 | survey.load(); |
| 215 | + // Click tracking |
| 216 | + trackClick( 'pitch-survey' ); |
206 | 217 | // Hide the pitch immediately |
207 | 218 | return true; |
208 | 219 | }, |
— | — | @@ -217,6 +228,8 @@ |
218 | 229 | ? lottery( 0.5 ) : false; |
219 | 230 | }, |
220 | 231 | 'action': function() { |
| 232 | + // Click tracking |
| 233 | + trackClick( 'pitch-join-signup' ); |
221 | 234 | // Go to account creation page |
222 | 235 | window.location = |
223 | 236 | mediaWiki.config.get( 'wgScript' ) + '?' + $.param( { |
— | — | @@ -235,6 +248,8 @@ |
236 | 249 | // Special alternative action for going to login page |
237 | 250 | 'altAccept': 'articlefeedback-pitch-join-login', |
238 | 251 | 'altAction': function() { |
| 252 | + // Click tracking |
| 253 | + trackClick( 'pitch-join-login' ); |
239 | 254 | // Go to login page |
240 | 255 | window.location = |
241 | 256 | mediaWiki.config.get( 'wgScript' ) + '?' + $.param( { |
— | — | @@ -263,6 +278,8 @@ |
264 | 279 | return !isPitchMuted( 'edit' ); |
265 | 280 | }, |
266 | 281 | 'action': function() { |
| 282 | + // Click tracking |
| 283 | + trackClick( 'pitch-edit' ); |
267 | 284 | // Go to edit page |
268 | 285 | window.location = |
269 | 286 | mediaWiki.config.get( 'wgScript' ) + '?' + $.param( { |
— | — | @@ -290,10 +307,8 @@ |
291 | 308 | .find( '#t-articlefeedback a' ) |
292 | 309 | .text( mw.msg( 'articlefeedback-form-switch-label' ) ) |
293 | 310 | .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' ); |
298 | 313 | // Get the image, set the count and an interval. |
299 | 314 | var $box = $( '#mw-articlefeedback' ); |
300 | 315 | var count = 0; |