[MediaWiki-commits] [Gerrit] mediawiki...ArticleCreationWorkflow[master]: Add eventlogging for link clicks on Special:CreatePage

2017-08-29 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/374436 )

Change subject: Add eventlogging for link clicks on Special:CreatePage
..


Add eventlogging for link clicks on Special:CreatePage

Bug: T173766
Change-Id: I4a2801f569f0665a71f03ebc5fd5b4f339bfcde4
---
M extension.json
M includes/SpecialCreatePage.php
A modules/acw.eventlogging.js
3 files changed, 34 insertions(+), 0 deletions(-)

Approvals:
  MaxSem: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/extension.json b/extension.json
index 9f72e64..fab2759 100644
--- a/extension.json
+++ b/extension.json
@@ -25,6 +25,17 @@
"i18n"
]
},
+   "ResourceFileModulePaths": {
+   "localBasePath": "modules",
+   "remoteExtPath": "ArticleCreationWorkflow/modules"
+   },
+   "ResourceModules": {
+   "ext.acw.eventlogging": {
+   "scripts": [
+   "acw.eventlogging.js"
+   ]
+   }
+   },
"ExtensionMessagesFiles": {
"ArticleCreationWorkflowAliases": 
"ArticleCreationWorkflow.alias.php"
},
diff --git a/includes/SpecialCreatePage.php b/includes/SpecialCreatePage.php
index bc48154..5cf8768 100644
--- a/includes/SpecialCreatePage.php
+++ b/includes/SpecialCreatePage.php
@@ -51,6 +51,7 @@
return;
}
 
+   $this->getOutput()->addModules( 'ext.acw.eventlogging' );
$this->getOutput()->addWikiText( $landingPageMessage->params( 
$destTitleText )->text() );
}
 }
diff --git a/modules/acw.eventlogging.js b/modules/acw.eventlogging.js
new file mode 100644
index 000..69d4041
--- /dev/null
+++ b/modules/acw.eventlogging.js
@@ -0,0 +1,22 @@
+/*
+ Track link clicks on Special:CreatePage
+ */
+
+( function ( $, mw ) {
+
+   function trackData( interactionType, link, sampling ) {
+   mw.loader.using( 'schema.ArticleCreationWorkflow' ).then( 
function () {
+   mw.eventLog.logEvent( 'ArticleCreationWorkflow', {
+   interactionType: interactionType,
+   link: link,
+   sampling: sampling ? sampling : 1
+   } );
+   } );
+   }
+
+   $( '#bodyContent' ).find( 'a' ).click( function ( event ) {
+   var $link = $( this ).attr( 'href' );
+   trackData( 'click', $link );
+   } );
+
+} ( jQuery, mediaWiki ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/374436
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4a2801f569f0665a71f03ebc5fd5b4f339bfcde4
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/ArticleCreationWorkflow
Gerrit-Branch: master
Gerrit-Owner: Niharika29 
Gerrit-Reviewer: MaxSem 
Gerrit-Reviewer: Niharika29 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...ArticleCreationWorkflow[master]: Add eventlogging for link clicks on Special:CreatePage

2017-08-28 Thread Niharika29 (Code Review)
Niharika29 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374436 )

Change subject: Add eventlogging for link clicks on Special:CreatePage
..

Add eventlogging for link clicks on Special:CreatePage

Bug: T173766
Change-Id: I4a2801f569f0665a71f03ebc5fd5b4f339bfcde4
---
M extension.json
M includes/SpecialCreatePage.php
A modules/acw.eventlogging.js
3 files changed, 34 insertions(+), 0 deletions(-)


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

diff --git a/extension.json b/extension.json
index 9f72e64..fab2759 100644
--- a/extension.json
+++ b/extension.json
@@ -25,6 +25,17 @@
"i18n"
]
},
+   "ResourceFileModulePaths": {
+   "localBasePath": "modules",
+   "remoteExtPath": "ArticleCreationWorkflow/modules"
+   },
+   "ResourceModules": {
+   "ext.acw.eventlogging": {
+   "scripts": [
+   "acw.eventlogging.js"
+   ]
+   }
+   },
"ExtensionMessagesFiles": {
"ArticleCreationWorkflowAliases": 
"ArticleCreationWorkflow.alias.php"
},
diff --git a/includes/SpecialCreatePage.php b/includes/SpecialCreatePage.php
index bc48154..5cf8768 100644
--- a/includes/SpecialCreatePage.php
+++ b/includes/SpecialCreatePage.php
@@ -51,6 +51,7 @@
return;
}
 
+   $this->getOutput()->addModules( 'ext.acw.eventlogging' );
$this->getOutput()->addWikiText( $landingPageMessage->params( 
$destTitleText )->text() );
}
 }
diff --git a/modules/acw.eventlogging.js b/modules/acw.eventlogging.js
new file mode 100644
index 000..8367417
--- /dev/null
+++ b/modules/acw.eventlogging.js
@@ -0,0 +1,22 @@
+/*
+ Track link clicks on Special:CreatePage
+ */
+
+( function ( $, mw ) {
+
+   function trackData( interactionType, link, sampling ) {
+   mw.loader.using( 'schema.ArticleCreationWorkflow' ).then( 
function () {
+   mw.eventLog.logEvent( 'ArticleCreationWorkflow', {
+   interactionType: interactionType,
+   link: link,
+   sampling: sampling ? sampling : false
+   } );
+   } );
+   }
+
+   $( '#bodyContent' ).find( 'a' ).click( function ( event ) {
+   var $link = $( this ).attr( 'href' );
+   trackData( 'click', $link );
+   } );
+
+} ( jQuery, mediaWiki ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/374436
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a2801f569f0665a71f03ebc5fd5b4f339bfcde4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ArticleCreationWorkflow
Gerrit-Branch: master
Gerrit-Owner: Niharika29 

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