Index: trunk/extensions/ArticleCreationWorkflow/modules/ext.articleCreation.user/ext.articleCreation.user.js |
— | — | @@ -72,9 +72,7 @@ |
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
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' ); |
79 | 77 | |
80 | 78 | $( this ) |
81 | 79 | //make it green |
— | — | @@ -138,9 +136,7 @@ |
139 | 137 | urlTemplate = urlTemplate.replace( '{{USER}}', encodeURIComponent( wgUserName ) ); |
140 | 138 | urlTemplate = urlTemplate.replace( '{{SCRIPT}}', wgScript ); |
141 | 139 | |
142 | | - if ( ac.config['tracking-turned-on'] ) { |
143 | | - jQuery.trackAction( ac.config['tracking-code-prefix'] + action ); |
144 | | - } |
| 140 | + ac.trackAction(article, action); |
145 | 141 | |
146 | 142 | window.location.href = urlTemplate; |
147 | 143 | }, |
— | — | @@ -156,6 +152,30 @@ |
157 | 153 | } |
158 | 154 | |
159 | 155 | 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 | + } |
160 | 180 | } |
161 | 181 | |
162 | 182 | }); |