Jack Phoenix has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/343427 )
Change subject: Remove references to ClickTracking and EventLogging ...................................................................... Remove references to ClickTracking and EventLogging Bug: T160801 Change-Id: I870e06f78355f60536ab67f2b22862ae3fba21d3 --- M ArticleFeedbackv5.hooks.php M extension.json M modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js M modules/ext.articleFeedbackv5/ext.articleFeedbackv5.talk.js M modules/ext.articleFeedbackv5/ext.articleFeedbackv5.watchlist.js M modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js M modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js D modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.track.js 8 files changed, 26 insertions(+), 543 deletions(-) Approvals: Jack Phoenix: Looks good to me, approved jenkins-bot: Verified diff --git a/ArticleFeedbackv5.hooks.php b/ArticleFeedbackv5.hooks.php index 5b22d6c..8941e15 100644 --- a/ArticleFeedbackv5.hooks.php +++ b/ArticleFeedbackv5.hooks.php @@ -273,7 +273,6 @@ $wgArticleFeedbackv5Debug, $wgArticleFeedbackv5DisplayBuckets, $wgArticleFeedbackv5CTABuckets, - $wgArticleFeedbackv5Tracking, $wgArticleFeedbackv5LinkBuckets, $wgArticleFeedbackv5Namespaces, $wgArticleFeedbackv5EnableProtection, @@ -291,7 +290,6 @@ $vars['wgArticleFeedbackv5Categories'] = $wgArticleFeedbackv5Categories; $vars['wgArticleFeedbackv5BlacklistCategories'] = $wgArticleFeedbackv5BlacklistCategories; $vars['wgArticleFeedbackv5Debug'] = $wgArticleFeedbackv5Debug; - $vars['wgArticleFeedbackv5Tracking'] = $wgArticleFeedbackv5Tracking; $vars['wgArticleFeedbackv5LinkBuckets'] = $wgArticleFeedbackv5LinkBuckets; $vars['wgArticleFeedbackv5Namespaces'] = $wgArticleFeedbackv5Namespaces; $vars['wgArticleFeedbackv5EnableProtection'] = $wgArticleFeedbackv5EnableProtection; @@ -373,104 +371,6 @@ } return true; - } - - /** - * Tracks successful edits - * - * @see https://www.mediawiki.org/wiki/Manual:Hooks/PageContentSaveComplete - * @param $article WikiPage - * @param $user - * @param $content - * @param $summary - * @param $isMinor - * @param $isWatch - * @param $section - * @param $flags - * @param $revision - * @param $status - * @param $baseRevId - * @return bool - */ - public static function editSuccess( $article, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $revision, $status, $baseRevId ) { - if ( $revision instanceof Revision ) { - $request = RequestContext::getMain()->getRequest(); - $feedbackId = $request->getVal( 'articleFeedbackv5_discuss_id' ); - $pageId = (int) $request->getVal( 'articleFeedbackv5_discuss_page' ); - $discussType = $request->getVal( 'articleFeedbackv5_discuss_type' ); - - if ( $feedbackId && $pageId && $discussType ) { - $feedback = ArticleFeedbackv5Model::get( $feedbackId, $pageId ); - - if ( $feedback ) { - $feedback->aft_discuss = $discussType; - - /* - * Before saving, the AFT data will be validated. If the discuss type - * is invalid, an exception will be thrown and the data will not be saved. - */ - try { - $feedback->update(); - } catch ( Exception $e ) { - /* - * It's great that tainted AFT data will not be inserted, but let's - * not stop the article edit when some AFT data is wrong. - */ - }; - } - } - - // track successful edit -// self::trackEvent( 'edit_success', $article->getTitle(), $revision->getID() ); - } else { - // track unsuccessful edit -// self::trackEvent( 'edit_norevision', $article->getTitle(), 0 ); - } - - return true; - } - - /** - * Tracks edit attempts - * - * @see http://www.mediawiki.org/wiki/Manual:Hooks/EditPage::attemptSave - * @param $editpage EditPage - * @return bool - */ - public static function editAttempt( $editpage ) { -// self::trackEvent( 'edit_attempt', $editpage->getArticle()->getTitle(), $editpage->getArticle()->getRevIdFetched()); // EditPage::getTitle() doesn't exist in 1.18wmf1 - return true; - } - - /** - * Internal use: Tracks an event - * - * @param $event string the event name - * @param $context IContextSource - * @return - */ - private static function trackEvent( $event, $title, $rev_id ) { - $request = RequestContext::getMain()->getRequest(); - - $tracking = $request->getVal( 'articleFeedbackv5_click_tracking' ); - if ( !$tracking ) { - return; - } - - $ctToken = $request->getVal( 'articleFeedbackv5_ct_cttoken' ); - $userToken = $request->getVal( 'articleFeedbackv5_ct_usertoken' ); - $ctEvent = $request->getVal( 'articleFeedbackv5_ct_event' ); - - /* - * if visitor has old - cached - JS, not all required values will be there - * and we should ignore this hit (it won't have the relevant JS-calls either) - */ - if ( !$ctToken ) { - return; - } - - // @todo: implement EventLogging if/once requested - // make sure sure to uncomment commented calls to self::trackEvent at that time } /** diff --git a/extension.json b/extension.json index 643e379..d2b329c 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "Article Feedback", - "version": "5.2.2", + "version": "5.2.3", "author": [ "Greg Chiasson", "Reha Sterbin", @@ -135,7 +135,6 @@ "jquery.ui.button", "jquery.articleFeedbackv5", "jquery.cookie", - "jquery.articleFeedbackv5.track", "jquery.articleFeedbackv5.utils", "mediawiki.api" ] @@ -153,13 +152,6 @@ "jquery.articleFeedbackv5.special" ] }, - "jquery.articleFeedbackv5.track": { - "scripts": "jquery.articleFeedbackv5/jquery.articleFeedbackv5.track.js", - "dependencies": [ - "mediawiki.util", - "mediawiki.user" - ] - }, "ext.articleFeedbackv5.talk": { "scripts": "ext.articleFeedbackv5/ext.articleFeedbackv5.talk.js", "styles": "ext.articleFeedbackv5/ext.articleFeedbackv5.talk.css", @@ -168,7 +160,6 @@ ], "dependencies": [ "jquery.articleFeedbackv5.utils", - "jquery.articleFeedbackv5.track", "mediawiki.api" ] }, @@ -177,9 +168,6 @@ "styles": "ext.articleFeedbackv5/ext.articleFeedbackv5.watchlist.css", "messages": [ "articlefeedbackv5-watchlist-view-feedback" - ], - "dependencies": [ - "jquery.articleFeedbackv5.track" ] }, "jquery.articleFeedbackv5": { @@ -285,7 +273,6 @@ "jquery.cookie", "jquery.placeholder", "mediawiki.jqueryMsg", - "jquery.articleFeedbackv5.track", "jquery.effects.highlight", "mediawiki.Uri" ] @@ -425,7 +412,6 @@ "mediawiki.util", "jquery.tipsy", "jquery.localize", - "jquery.articleFeedbackv5.track", "json", "jquery.ui.button" ] @@ -582,16 +568,6 @@ "6": 100 }, "version": 6, - "expires": 30 - }, - "ArticleFeedbackv5Tracking": { - "buckets": { - "ignore": 100, - "track": 0, - "track-front": 0, - "track-special": 0 - }, - "version": 11, "expires": 30 }, "ArticleFeedbackv5LinkBuckets": { diff --git a/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js b/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js index 94372f2..5f2c46f 100644 --- a/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js +++ b/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js @@ -43,8 +43,7 @@ // Add the link to the feedback-page next to the title var $link = $( '<a id="articlefeedbackv5-article-feedback-link"></a>' ) .msg( 'articlefeedbackv5-article-view-feedback', count ) - .attr( 'href', url ) - .click( { trackingId: 'article_page_view_feedback-button_click' }, $.aftTrack.trackEvent ); + .attr( 'href', url ); /* * Add the link next to #siteSub. Append to #siteSub node if @@ -57,38 +56,8 @@ $link.insertAfter( '#siteSub' ); } - // Track an impression - $.aftTrack.init(); - $.aftTrack.track( 'article_page_view_feedback-impression' ); } } - } ); -} - -/* Add basic edit tracking, making use of $.aftTrack() already being set up */ -if ( $.aftTrack.clickTrackingOn ) { - var editEventBase = $.aftTrack.prefix( $aftDiv.articleFeedbackv5( 'experiment' ) ); - - $( 'span.editsection a, #ca-edit a, #ca-viewsource a' ).each( function() { - if ( $(this).is( '#ca-edit a' ) ) { - var event = 'edit_tab_link'; - } else if ( $(this).is( '#ca-viewsource a' ) ) { - var event = 'view_source_tab_link'; - } else { - var event = 'section_edit_link'; - } - - var href = $( this ).attr( 'href' ); - var editUrl = href + ( href.indexOf( '?' ) >= 0 ? '&' : '?' ) + $.param( { - 'articleFeedbackv5_click_tracking': 1, - 'articleFeedbackv5_ct_cttoken': $.cookie( 'clicktracking-session' ), - 'articleFeedbackv5_ct_usertoken': mw.user.id(), - 'articleFeedbackv5_ct_event': editEventBase + '-' + event - } ); - - $(this) - .attr( 'href', editUrl ) - .click( { trackingId: event + '-click' }, $.aftTrack.trackEvent ); } ); } diff --git a/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.talk.js b/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.talk.js index a3600da..173b202 100644 --- a/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.talk.js +++ b/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.talk.js @@ -37,8 +37,7 @@ // Add the link to the feedback-page next to the title var $link = $( '<a id="articlefeedbackv5-talk-feedback-link"></a>' ) .text( mw.msg( 'articlefeedbackv5-talk-view-feedback' ) ) - .attr( 'href', url ) - .click( { trackingId: 'talk_page_view_feedback-button_click' }, $.aftTrack.trackEvent ); + .attr( 'href', url ); /* * Add the link next to #siteSub. Append to #siteSub node if @@ -51,9 +50,6 @@ $link.insertAfter( '#siteSub' ); } - // Track an impression - $.aftTrack.init(); - $.aftTrack.track( 'talk_page_view_feedback-impression' ); } } } ); diff --git a/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.watchlist.js b/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.watchlist.js index 618e75d..1bde63c 100644 --- a/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.watchlist.js +++ b/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.watchlist.js @@ -13,11 +13,6 @@ return; } - // Initialize clicktracking - // NB: Using the talk page's namespace, title, and rev id, not - // the article's as in the front end tracking - $.aftTrack.init(); - // Build the url to the Special:ArticleFeedbackv5Watchlist page var params = { ref: 'watchlist' }; var url = mw.config.get( 'wgScript' ) + '?title=' + @@ -28,13 +23,10 @@ var link = $( '<a id="articlefeedbackv5-watchlist-feedback-link"></a>' ); link .text( mw.msg( 'articlefeedbackv5-watchlist-view-feedback' ) ) - .attr( 'href', url ) - .click( { trackingId: 'watchlist_view_feedback-button_click' }, $.aftTrack.trackEvent ); + .attr( 'href', url ); $( '#contentSub' ).append( link ); - // Track an impression - $.aftTrack.track( 'watchlist_view_feedback-impression' ); } } ); diff --git a/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js b/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js index d9d1410..f50d30e 100644 --- a/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js +++ b/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js @@ -176,11 +176,6 @@ $.articleFeedbackv5.nowShowing = 'none'; /** - * The feedback ID (collected on submit, for use in tracking edits) - */ - $.articleFeedbackv5.feedbackId = 0; - - /** * The new feedback's permalink (collected on submit, for use in CTA5) */ $.articleFeedbackv5.permalink = undefined; @@ -592,8 +587,7 @@ } $block.find( '.articleFeedbackv5-cta-button' ) - .attr( 'href', url ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + 'button_click' }, $.aftTrack.trackEvent ); + .attr( 'href', url ); // Turn the submit into a slick button $block.find( '.articleFeedbackv5-cta-button' ) @@ -739,7 +733,6 @@ e.preventDefault(); var new_val = $( this ).parents( '[data-value]' ).data( 'value' ); - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'click_' + new_val ); var $wrap = $.articleFeedbackv5.$holder.find( '#articleFeedbackv5-bucket6-toggle-wrapper-' + new_val ); @@ -1042,7 +1035,6 @@ // Fill in the link $block.find( '.articleFeedbackv5-cta-button' ) .attr( 'href', $.articleFeedbackv5.editUrl() ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-button_click' }, $.aftTrack.trackEvent ) .button() .addClass( 'ui-button-blue' ); @@ -1109,7 +1101,6 @@ $block .find( '.articleFeedbackv5-cta-button' ) .attr( 'href', mw.msg( 'articlefeedbackv5-cta1-learn-how-url' ) ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-button_click' }, $.aftTrack.trackEvent ) .button() .addClass( 'ui-button-blue' ); @@ -1202,7 +1193,6 @@ $block .find( '.articleFeedbackv5-cta-button' ) .attr( 'href', survey_url + '?c=' + $.articleFeedbackv5.feedbackId ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-button_click' }, $.aftTrack.trackEvent ) .button() .addClass( 'ui-button-blue' ); } @@ -1338,8 +1328,7 @@ 'c': $.articleFeedbackv5.feedbackId } ); $block.find( '.articleFeedbackv5-cta-button-signup' ) - .attr( 'href', signup_url ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-button_signup_click' }, $.aftTrack.trackEvent ); + .attr( 'href', signup_url ); var login_url = mw.config.get( 'wgScript' ) + '?' + $.param( { 'title': 'Special:UserLogin', @@ -1347,8 +1336,7 @@ 'c': $.articleFeedbackv5.feedbackId } ); $block.find( '.articleFeedbackv5-cta-button-login' ) - .attr( 'href', login_url ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-button_login_click' }, $.aftTrack.trackEvent ); + .attr( 'href', login_url ); $block.find( '.articleFeedbackv5-cta-button' ) .button() @@ -1450,7 +1438,6 @@ // Fill in the link $block.find( '.articleFeedbackv5-cta-button' ) .attr( 'href', $.articleFeedbackv5.specialUrl + '#' + $.articleFeedbackv5.feedbackId ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-button_click' }, $.aftTrack.trackEvent ) .button() .addClass( 'ui-button-blue' ); @@ -1532,7 +1519,6 @@ // Fill in the link $block.find( '.articleFeedbackv5-cta-button' ) .attr( 'href', mw.msg( 'articlefeedbackv5-cta6-button-link' ) ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-button_click' }, $.aftTrack.trackEvent ) .button() .addClass( 'ui-button-blue' ); @@ -1633,7 +1619,7 @@ .text( mw.msg( 'articlefeedbackv5-sitesub-linktext' ) ) .click( function ( e ) { e.preventDefault(); - $.articleFeedbackv5.clickTriggerLink( $( e.target ) ); + $.articleFeedbackv5.highlightForm(); } ); return $link; }, @@ -1697,7 +1683,7 @@ .text( mw.msg( 'articlefeedbackv5-titlebar-linktext' ) ) .click( function ( e ) { e.preventDefault(); - $.articleFeedbackv5.clickTriggerLink( $( e.target ) ); + $.articleFeedbackv5.highlightForm(); } ); if ( $( '#coordinates' ).length ) { $link.css( 'margin-top: 2.5em' ); @@ -1760,7 +1746,7 @@ .attr( 'title', mw.msg( 'articlefeedbackv5-fixedtab-linktext' ) ) .click( function ( e ) { e.preventDefault(); - $.articleFeedbackv5.clickTriggerLink( $( e.target ) ); + $.articleFeedbackv5.highlightForm(); } ); return $link; } @@ -1820,7 +1806,7 @@ .text( mw.msg( 'articlefeedbackv5-bottomrighttab-linktext' ) ) .click( function ( e ) { e.preventDefault(); - $.articleFeedbackv5.clickTriggerLink( $( e.target ) ); + $.articleFeedbackv5.highlightForm(); } ); return $link; } @@ -1898,7 +1884,7 @@ .text( mw.msg( 'articlefeedbackv5-bottomrighttab-linktext' ) ) .click( function ( e ) { e.preventDefault(); - $.articleFeedbackv5.clickTriggerLink( $( e.target ) ); + $.articleFeedbackv5.highlightForm(); } ); return $link; } @@ -2001,7 +1987,7 @@ .text( mw.msg( 'articlefeedbackv5-section-linktext' ) ) .click( function ( e ) { e.preventDefault(); - $.articleFeedbackv5.clickTriggerLink( $( e.target ) ); + $.articleFeedbackv5.highlightForm(); } ); return $wrap; }, @@ -2064,7 +2050,7 @@ .data( 'linkId', 'TBX' ) .click( function ( e ) { e.preventDefault(); - $.articleFeedbackv5.clickTriggerLink( $( e.target ) ); + $.articleFeedbackv5.highlightForm(); } ); } @@ -2076,8 +2062,7 @@ var $linkView = $( '<li id="t-articlefeedbackv5-view"><a href="#"></a></li>' ); $linkView.find( 'a' ) .text( mw.msg( 'articlefeedbackv5-toolbox-view' ) ) - .attr( 'href', mw.config.get( 'wgArticleFeedbackv5SpecialUrl' ) + '/' + mw.config.get( 'wgPageName' ) ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-toolbar_click' }, $.aftTrack.trackEvent ); + .attr( 'href', mw.config.get( 'wgArticleFeedbackv5SpecialUrl' ) + '/' + mw.config.get( 'wgPageName' ) ); return $linkAdd.add( $linkView ); }, @@ -2129,8 +2114,6 @@ if ( reqDebug ) { $.articleFeedbackv5.debug = reqDebug == 'false' ? false : true; } - // Initialize clicktracking - $.aftTrack.init(); // Go ahead and bucket right away $.articleFeedbackv5.selectBucket(); $.articleFeedbackv5.selectCTA(); @@ -2144,22 +2127,14 @@ $.articleFeedbackv5.$holder.appear( function () { if ( !$.articleFeedbackv5.isLoaded ) { $.articleFeedbackv5.load( 'auto' ); - // Track form impressions - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'impression' ); } } ); + // Keep track of links that must be removed after a successful submission $.articleFeedbackv5.$toRemove = $( [] ); + // Add them $.articleFeedbackv5.addTriggerLinks(); - // Track init at 1% - if ( Math.random() * 100 < 1 ) { - if ( $.articleFeedbackv5.editable ) { - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'init' ); - } else { - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'noedit-init' ); - } - } // Adding hash in url will not scroll down to this id, because the element // won't exist until .appear is triggered. Let's just simulate this ourselves. if ( '#' + $el.attr( 'id' ) === window.location.hash ) { @@ -2404,23 +2379,13 @@ // {{{ editUrl /** - * Builds the edit URL, with tracking if appropriate - * - * @param trackingId string the tracking ID + * Builds the edit URL */ $.articleFeedbackv5.editUrl = function () { var params = { 'title': mw.config.get( 'wgPageName' ), - 'action': 'edit', - 'articleFeedbackv5_click_tracking': $.aftTrack.clickTrackingOn ? '1' : '0' + 'action': 'edit' }; - if ( $.aftTrack.clickTrackingOn ) { - var event = $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName(); - - params.articleFeedbackv5_ct_cttoken = $.cookie( 'clicktracking-session' ); - params.articleFeedbackv5_ct_usertoken = mw.user.id(); - params.articleFeedbackv5_ct_event = $.aftTrack.prefix( event ); - } return mw.config.get( 'wgScript' ) + '?' + $.param( params ); }; @@ -2659,9 +2624,6 @@ } ); } - // Track the submit click - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'submit_attempt' ); - // Send off the ajax request $.ajax( { 'url': $.articleFeedbackv5.apiUrl, @@ -2697,8 +2659,6 @@ $.articleFeedbackv5.$toRemove.remove(); $.articleFeedbackv5.$toRemove = $( [] ); - // Track the success - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'submit_success' ); } else { var msg = mw.msg( 'articlefeedbackv5-error-unknown' ); var code = 'unknown'; @@ -2712,9 +2672,6 @@ code = data.warning.code; } - // Track the error - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'submit_error_' + code ); - // Set up error state $.articleFeedbackv5.markFormErrors( msg ); } @@ -2722,9 +2679,6 @@ 'error': function (xhr, tstatus, error) { var msg = mw.msg( 'articlefeedbackv5-error-submit' ); var code = 'jquery'; - - // Track the error - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'submit_error_' + code ); // Set up error state $.articleFeedbackv5.markFormErrors( msg ); @@ -2838,8 +2792,11 @@ .localize( { 'prefix': 'articlefeedbackv5-' } ); title - .find( '.articleFeedbackv5-confirmation-follow-up' ).msg( 'articlefeedbackv5-cta-confirmation-message', $.articleFeedbackv5.specialUrl + '#' + $.articleFeedbackv5.feedbackId ) - .find( 'a' ).click( { trackingId: $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-permalink_click' }, $.aftTrack.trackEvent ); + .find( '.articleFeedbackv5-confirmation-follow-up' ) + .msg( + 'articlefeedbackv5-cta-confirmation-message', + $.articleFeedbackv5.specialUrl + '#' + $.articleFeedbackv5.feedbackId + ); } $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-title' ) .empty() @@ -2865,9 +2822,6 @@ // The close element needs to be created anyway, to serve as an anchor, but needs to be hidden $close.hide(); - - // Track the event - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + $.articleFeedbackv5.ctaName() + '-impression' ); $.articleFeedbackv5.nowShowing = 'cta'; }; @@ -2988,7 +2942,6 @@ '#mw-prefsection-rendering'; $flyover.find( '.articleFeedbackv5-disable-flyover-button' ) .attr( 'href', prefLink ) - .click( { trackingId: $.articleFeedbackv5.experiment() + '-' + 'disable_gotoprefs_click' }, $.aftTrack.trackEvent ) .button() .addClass( 'ui-button-blue' ); @@ -2996,7 +2949,6 @@ .attr( 'href', '#hello' ) .attr( 'rel', linkId ); - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'disable_flyover-impression' ); return $flyover.html(); } } ) @@ -3010,7 +2962,6 @@ } else { $host.tipsy( 'show' ); $wrap.addClass( 'articleFeedbackv5-tipsy-active' ); - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + 'disable_button_click' ); } } ); }; @@ -3188,21 +3139,6 @@ }; // }}} - // {{{ clickTriggerLink - - /** - * Handles the click event on a trigger link - * - * @param $link Element the trigger link - */ - $.articleFeedbackv5.clickTriggerLink = function ( $link ) { - var tracking_id = 'trigger' + $link.data( 'linkId' ) + '-click-overlay'; - $.aftTrack.track( $.articleFeedbackv5.experiment() + '-' + tracking_id ); - - $.articleFeedbackv5.highlightForm(); - }; - - // }}} // }}} // {{{ articleFeedbackv5 plugin @@ -3244,4 +3180,3 @@ // }}} } )( jQuery ); - diff --git a/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js b/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js index 3b072b4..3ae9076 100644 --- a/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js +++ b/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js @@ -186,13 +186,6 @@ // check if there is feedback $.articleFeedbackv5special.emptyMessage(); - // Initialize clicktracking - $.aftTrack.init({ - pageName: $.articleFeedbackv5special.page, - revisionId: 0, - isSpecial: true - }); - // Grab the user's activity out of the cookie $.articleFeedbackv5special.loadActivity(); @@ -233,34 +226,10 @@ ); $.articleFeedbackv5special.processFeedback(); - // Track an impression - $.aftTrack.track( 'feedback_page-impression-' + - $.articleFeedbackv5special.referral + '-' + - $.articleFeedbackv5special.userType ); }; // }}} - // {{{ checkClickTracking - /** - * Checks whether click tracking is turned on - * - * Only track users who have been assigned to the tracking group; don't bucket - * at all if we're set to always ignore or always track. - */ - $.articleFeedbackv5special.checkClickTracking = function() { - var b = mw.config.get( 'wgArticleFeedbackv5Tracking' ); - if ( b.buckets.ignore == 100 && b.buckets.track == 0 ) { - return false; - } - if ( b.buckets.ignore == 0 && b.buckets.track == 100 ) { - return true; - } - var key = 'ext.articleFeedbackv5@' + b.version + '-tracking'; - return ( 'track' === mw.user.bucket( key, b ) ); - }; - - // }}} // {{{ initTipties /** @@ -530,12 +499,6 @@ $.articleFeedbackv5special.listControls.offset = null; $.articleFeedbackv5special.setSortByFilter( id ); - // track the filter change - $.aftTrack.track( 'feedback_page-click-' + - 'f_' + $.articleFeedbackv5special.getFilterName( id ) + '-' + - $.articleFeedbackv5special.referral + '-' + - $.articleFeedbackv5special.userType ); - // update filter in select (if present) & text-links (if any) $( '#articleFeedbackv5-select-wrapper' ).removeClass( 'filter-active' ); $( '.articleFeedbackv5-filter-link' ).removeClass( 'filter-active' ); @@ -635,19 +598,7 @@ }; // }}} - // {{{ getFilterName - /** - * Utility method: Gets the filter name from its internal-use ID - * - * @param filter string the internal-use id of the filter - * @return string the filter name for use in clicktracking - */ - $.articleFeedbackv5special.getFilterName = function ( filter ) { - return filter; - }; - - // }}} // {{{ setSortByFilter /** @@ -657,10 +608,9 @@ * @param filter string the internal-use id of the filter */ $.articleFeedbackv5special.setSortByFilter = function ( filter ) { - var shortName = $.articleFeedbackv5special.getFilterName( filter ); var defaults = mw.config.get( 'wgArticleFeedbackv5DefaultSorts' ); - if ( shortName in defaults ) { - $.articleFeedbackv5special.toggleSort( defaults[shortName][0], defaults[shortName][1] ); + if ( filter in defaults ) { + $.articleFeedbackv5special.toggleSort( defaults[filter][0], defaults[filter][1] ); } else { $.articleFeedbackv5special.toggleSort( 'age', 'DESC' ); } diff --git a/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.track.js b/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.track.js deleted file mode 100644 index ad127f0..0000000 --- a/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.track.js +++ /dev/null @@ -1,235 +0,0 @@ -/** - * ArticleFeedback tracking plugin - * - * This file creates the plugin that will be used to track usage of the Article - * Feedback tool. - * - * @package ArticleFeedback - * @subpackage Resources - * @author Reha Sterbin <r...@omniti.com> - * @version $Id$ - */ - -( function ( $ ) { - -// {{{ aftTrack definition - - $.aftTrack = {}; - - // {{{ Properties - - /** - * Are we tracking clicks? - */ - $.aftTrack.clickTrackingOn = false; - - /** - * The page name we'll be sending with the tracking - */ - $.aftTrack.pageName = mw.config.get( 'wgPageName' ); - - /** - * The revision ID we'll be sending with the tracking - */ - $.aftTrack.revisionId = mw.config.get( 'wgCurRevisionId' ); - - /** - * Is this the front end or the special page? - */ - $.aftTrack.isSpecial = false; - - /** - * Array of events caught by trackEvent. - * - * @var array - */ - $.aftTrack.events = []; - - // }}} - // {{{ init - - /** - * Initializes the object - * - * The init method sets up the object once the plugin has been called. - * - * @param config object the config object - */ - $.aftTrack.init = function ( config ) { - // Fill in options from the config - config = config || {}; - if ( 'pageName' in config ) { - $.aftTrack.pageName = config.pageName; - } - if ( 'revisionId' in config ) { - $.aftTrack.revisionId = config.revisionId; - } - if ( 'isSpecial' in config && config.isSpecial ) { - $.aftTrack.isSpecial = true; - } - // Are we tracking clicks? - var b = mw.config.get( 'wgArticleFeedbackv5Tracking' ); - var key = 'ext.articleFeedbackv5@' + b.version + '-tracking'; - var setting = mw.user.bucket( key, b ); - if ( setting == 'track' || - ( setting == 'track-special' && $.aftTrack.isSpecial ) || - ( setting == 'track-front' && !$.aftTrack.isSpecial ) ) { - $.aftTrack.clickTrackingOn = true; - } else { - $.aftTrack.clickTrackingOn = false; - } - }; - - // }}} - // {{{ additional - - /** - * Builds the additional data to pass with events - * - * @return string the additional data string - */ - $.aftTrack.additional = function () { - var tmp = new Array(); - tmp.push( mw.user.id() ); - if ( $.aftTrack.pageName != '' ) { - tmp.push( $.aftTrack.pageName ); - } - if ( $.aftTrack.revisionId != 0 ) { - tmp.push( $.aftTrack.revisionId ); - } - return tmp.join( '|' ); - }; - - // }}} - // {{{ track - - /** - * Send something toward ClickTracking API - * - * @param string trackingId - */ - $.aftTrack.track = function ( trackingId ) { - if ( $.aftTrack.clickTrackingOn ) { - // @todo: implement EventLogging if/once requested - } - - return $.Deferred().resolve(); - }; - - // }}} - // {{{ trackEvent - - /** - * Tracks an event - * Example usage: $(this).click( { trackingId: 'trackingId' }, $.aftTrack.trackEvent ); - * - * @param object e - */ - $.aftTrack.trackEvent = function ( e ) { - /* - * Manually triggered (by this function) 2nd event. At this point, the - * ClickTracking call has been completed. We can now resume the event's - * default behavior or other bound event handlers (if any), but abort - * this function, it has been run. - */ - if ( ! ( e.type in $.aftTrack.events ) ) { - $.aftTrack.events[e.type] = []; - } - var eventIndex = $.inArray( e.target, $.aftTrack.events[e.type] ); - if ( eventIndex > -1 ) { - $.aftTrack.events[e.type].splice( eventIndex, 1 ); - return true; - } - $.aftTrack.events[e.type].push( e.target ); - - // sanity check: valid call? - if ( typeof e.data == 'undefined' || typeof e.data.trackingId == 'undefined' ) { - return false; - } - - /* - * In windows, ctrl key will usually open in new tab; osx is command key. - * Shift key will open links in new window. - * If this is pressed, the link will fire in new tab, which is ok, since - * the current page remains open and the ajax call. In this case, let's - * not block the default behaviour & just let it open the new tab - only - * block default behaviour if the ctrl/meta button is _not_ pressed. - */ - if ( !e.ctrlKey && !e.metaKey && !e.shiftKey ) { - /* - * IE does not appear to support a way to simulate a real event. Since we can - * not resume an event nor trigger an exact new one, let's just not stop this - * one (for IE) - I'm aware that this may result in aborted ClickTracking calls, - * but correct UX behaviour is more important - */ - if ( typeof e.target.fireEvent == 'undefined' ) { - /** - * $.trackActionWithInfo ends with a $.post to submit the data to - * ClickTracking API. We do not want any default behaviour to - * interrupt that ajax call, so prevent any default behaviour (e.g. - * redirect to a clicked link's href) until the call has completed - */ - e.preventDefault(); - e.stopPropagation(); - } - } - - // submit call to ClickTracking API - $.aftTrack.track( e.data.trackingId ) - .done( function () { - // only resume event if link wasn't opened in new tab/window - if ( !e.ctrlKey && !e.metaKey && !e.shiftKey ) { - if ( typeof e.target.dispatchEvent != 'undefined' ) { - /* - * Multiple browsers support dispatchEvent, though with - * different behaviour. - * Opera (maybe other browsers as well) supports the general - * "Events" as parameter for createEvent. Firefox (and maybe - * others) need an exact e.g. "MouseEvent" for mouse events. - * Opera will know what to do based on the first parameter - * passed to initEvent (which is the actual event to perform), - * Firefox however will ignore this. - * IE9 does not appear to do much either way. - * IE8 and lower do not even support dispatchEvent. - * I do want to use the general "Events" though to keep this - * code general-purpose. - * If evt.eventPhase equals 0 (browsers other than Opera), the - * event will not properly be triggered, in which case we fall - * back to other methods. - * - * @see https://developer.mozilla.org/en-US/docs/DOM/event.eventPhase - */ - var evt = document.createEvent( 'Events' ); - evt.initEvent( e.type, e.bubbles, e.cancelable ); - } - if ( typeof evt != 'undefined' && evt.eventPhase > 0 ) { - e.target.dispatchEvent( evt ); - } else { - if ( typeof e.target.fireEvent != 'undefined' ) { - /* - * IE-specific; IE does not support <target>.<event>(); - * This will only fire attached events, but will not simulate - * a "real event" (as in: triggering a click on a link will - * not make the browser follow the link) - */ - e.target.fireEvent( 'on' + e.type ); - } else { - /** - * Firefox, Safari, Chrome & possibly others simulate a "real - * event" from this (Opera & IE do not) - */ - e.target[ e.type ](); - } - } - } - } - ); - - return true; - }; - - // }}} - -// }}} - -} )( jQuery ); -- To view, visit https://gerrit.wikimedia.org/r/343427 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I870e06f78355f60536ab67f2b22862ae3fba21d3 Gerrit-PatchSet: 6 Gerrit-Project: mediawiki/extensions/ArticleFeedbackv5 Gerrit-Branch: master Gerrit-Owner: SamanthaNguyen <samanthanguyen1...@gmail.com> Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits