r111003 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111002‎ | r111003 | r111004 >
Date:01:06, 9 February 2012
Author:werdna
Status:ok
Tags:
Comment:
Add the page in question to ClickTracking data.
Modified paths:
  • /trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js
@@ -72,9 +72,7 @@
7373 return;
7474 }
7575
76 - if ( ac.config['tracking-turned-on'] ) {
77 - jQuery.trackAction( ac.config['tracking-code-prefix'] + $(this).data('ac-button' ) + '-tooltip' );
78 - }
 76+ ac.trackAction( $(this).data('ac-button' ) + '-interstitial' );
7977
8078 $( this )
8179 //make it green
@@ -138,9 +136,7 @@
139137 urlTemplate = urlTemplate.replace( '{{USER}}', encodeURIComponent( wgUserName ) );
140138 urlTemplate = urlTemplate.replace( '{{SCRIPT}}', wgScript );
141139
142 - if ( ac.config['tracking-turned-on'] ) {
143 - jQuery.trackAction( ac.config['tracking-code-prefix'] + action );
144 - }
 140+ ac.trackAction(article, action);
145141
146142 window.location.href = urlTemplate;
147143 },
@@ -156,6 +152,30 @@
157153 }
158154
159155 return false;
 156+ },
 157+
 158+ trackAction : function(article, action) {
 159+ if ( ac.config['tracking-turned-on'] ) {
 160+ // Split up article into namespace and title
 161+ var namespace = article.substr( 0, article.indexOf(':') ),
 162+ title = article.substr( article.indexOf(':') + 1 ),
 163+ namespaceNumber;
 164+
 165+ namespace = namespace.toLowerCase();
 166+ namespaceNumber = mw.config.get('wgNamespaceIds')[namespace];
 167+
 168+ if ( typeof namespaceNumber === 'undefined' ) {
 169+ namespace = '';
 170+ namespaceNumber = 0;
 171+ title = article;
 172+ }
 173+
 174+ jQuery.trackActionWithOptions( {
 175+ id : ac.config['tracking-code-prefix'] + action,
 176+ namespace : namespaceNumber,
 177+ info : title
 178+ } );
 179+ }
160180 }
161181
162182 });

Status & tagging log