jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/377658 )
Change subject: Add back eventlogging since we're doing the landing page once more ...................................................................... Add back eventlogging since we're doing the landing page once more Bug: T175756 Change-Id: Ibd9515c68696f53dd1f195bf7579979e0d743f93 --- M extension.json M includes/Hooks.php A modules/ext.acw.eventlogging.js 3 files changed, 53 insertions(+), 4 deletions(-) Approvals: jenkins-bot: Verified Kaldari: Looks good to me, approved diff --git a/extension.json b/extension.json index 77506ea..7b53a0e 100644 --- a/extension.json +++ b/extension.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "ArticleCreationWorkflow", "type": "other", - "author": [ "Max Semenik" ], + "author": [ "Max Semenik", "Niharika Kohli" ], "url": "https://www.mediawiki.org/wiki/Extension:ArticleCreationWorkflow", "descriptionmsg": "acw-desc", "license-name": "MIT", @@ -11,7 +11,8 @@ }, "Hooks": { "CustomEditor": "ArticleCreationWorkflow\\Hooks::onCustomEditor", - "ShowMissingArticle": "ArticleCreationWorkflow\\Hooks::onShowMissingArticle" + "ShowMissingArticle": "ArticleCreationWorkflow\\Hooks::onShowMissingArticle", + "BeforePageDisplay": "ArticleCreationWorkflow\\Hooks::onBeforePageDisplay" }, "AutoloadClasses": { "ArticleCreationWorkflow\\Hooks": "includes/Hooks.php", @@ -22,6 +23,17 @@ "i18n" ] }, + "ResourceFileModulePaths": { + "localBasePath": "modules", + "remoteExtPath": "ArticleCreationWorkflow/modules" + }, + "ResourceModules": { + "ext.acw.eventlogging": { + "scripts": [ + "ext.acw.eventlogging.js" + ] + } + }, "config": { "ArticleCreationWorkflows": { "description": "Describes conditions when new page creation should be intercepted. See doc/config.txt for details.", diff --git a/includes/Hooks.php b/includes/Hooks.php index 7d0460c..5c92238 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -5,6 +5,7 @@ use MediaWiki\MediaWikiServices; use Article; use User; +use OutputPage; /** * Hook handlers @@ -32,7 +33,7 @@ $redirTo = $workflow->getLandingPageTitle(); $output = $article->getContext()->getOutput(); $output->redirect( $redirTo->getFullURL( - [ 'page' => $title->getPrefixedText(), 'wprov' => 'acww1' ] + [ 'page' => $title->getPrefixedText() ] ) ); return false; } @@ -63,8 +64,24 @@ $redirTo = $workflow->getLandingPageTitle(); $output = $article->getContext()->getOutput(); $output->redirect( $redirTo->getFullURL( - [ 'page' => $title->getPrefixedText(), 'wprov' => 'acww1' ] + [ 'page' => $title->getPrefixedText() ] ) ); } } + + /** + * BeforePageDisplay hook handler + * If user is landing on our landing page, we add eventlogging + * + * @param OutputPage $out OutputPage instance + */ + public static function onBeforePageDisplay( OutputPage $out ) { + $config = MediaWikiServices::getInstance() + ->getConfigFactory() + ->makeConfig( 'ArticleCreationWorkflow' ); + $workflow = new Workflow( $config ); + if ( $out->getPageTitle() == $workflow->getLandingPageTitle() ) { + $out->addModules( 'ext.acw.eventlogging' ); + } + } } diff --git a/modules/ext.acw.eventlogging.js b/modules/ext.acw.eventlogging.js new file mode 100644 index 0000000..308d0f9 --- /dev/null +++ b/modules/ext.acw.eventlogging.js @@ -0,0 +1,20 @@ +/* + Track link clicks on landing page created for ACTRIAL + */ + +( function ( $, mw ) { + + function trackData( interactionType, link, sampling ) { + mw.track( 'event.ArticleCreationWorkflow', { + interactionType: interactionType, + link: link, + sampling: sampling || 1 + } ); + } + + $( 'html' ).on( 'click', '#bodyContent a', function ( event ) { + var link = $( this ).attr( 'href' ); + trackData( 'click', link ); + } ); + +} ( jQuery, mediaWiki ) ); -- To view, visit https://gerrit.wikimedia.org/r/377658 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibd9515c68696f53dd1f195bf7579979e0d743f93 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/ArticleCreationWorkflow Gerrit-Branch: master Gerrit-Owner: Niharika29 <nko...@wikimedia.org> Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits