Niharika29 has uploaded a new change for review. ( 
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: T175613
Change-Id: Ibd9515c68696f53dd1f195bf7579979e0d743f93
---
M extension.json
M includes/Hooks.php
A modules/ext.acw.eventlogging.js
3 files changed, 34 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ArticleCreationWorkflow 
refs/changes/58/377658/1

diff --git a/extension.json b/extension.json
index 77506ea..cd99f50 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",
@@ -22,6 +22,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..49e9693 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -31,6 +31,7 @@
                        // If the landing page didn't exist, we wouldn't have 
intercepted.
                        $redirTo = $workflow->getLandingPageTitle();
                        $output = $article->getContext()->getOutput();
+                       $output->addModules( 'ext.acw.eventlogging' );
                        $output->redirect( $redirTo->getFullURL(
                                [ 'page' => $title->getPrefixedText(), 'wprov' 
=> 'acww1' ]
                        ) );
@@ -62,6 +63,7 @@
                        // If the landing page didn't exist, we wouldn't have 
intercepted.
                        $redirTo = $workflow->getLandingPageTitle();
                        $output = $article->getContext()->getOutput();
+                       $output->addModules( 'ext.acw.eventlogging' );
                        $output->redirect( $redirTo->getFullURL(
                                [ 'page' => $title->getPrefixedText(), 'wprov' 
=> 'acww1' ]
                        ) );
diff --git a/modules/ext.acw.eventlogging.js b/modules/ext.acw.eventlogging.js
new file mode 100644
index 0000000..23e08dd
--- /dev/null
+++ b/modules/ext.acw.eventlogging.js
@@ -0,0 +1,20 @@
+/*
+ Track link clicks on Special:CreatePage
+ */
+
+( 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: newchange
Gerrit-Change-Id: Ibd9515c68696f53dd1f195bf7579979e0d743f93
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ArticleCreationWorkflow
Gerrit-Branch: master
Gerrit-Owner: Niharika29 <nko...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to