mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-09-23 18:28:34 +00:00
Instrument mobile talk page clicks
This results in log events for clicking the following on a talk page: * Read as wiki page * Section headings * the "add section" button To test install WikimediaEvents and set $wgWMEMobileWebUIActionsTracking = 1; Bug: T294738 Change-Id: I8dbad7f4e72cfd081896480ba142b4e1e3029bcd
This commit is contained in:
parent
2a60efef79
commit
1acb3542a5
|
@ -284,7 +284,10 @@ class SkinMinerva extends SkinMustache {
|
|||
return MediaWikiServices::getInstance()->getLinkRenderer()->makeLink(
|
||||
$subjectPage,
|
||||
$this->msg( $msg, $title->getText() )->text(),
|
||||
[ 'class' => 'return-link' ]
|
||||
[
|
||||
'data-event-name' => 'talk.returnto',
|
||||
'class' => 'return-link'
|
||||
]
|
||||
);
|
||||
} else {
|
||||
return '';
|
||||
|
@ -618,7 +621,9 @@ class SkinMinerva extends SkinMustache {
|
|||
) {
|
||||
$addTopicButton = $this->getTalkButton( $title, wfMessage(
|
||||
'minerva-talk-add-topic' )->text(), true );
|
||||
$html = Html::element( 'a', $addTopicButton['attributes'], $addTopicButton['label'] );
|
||||
$html = Html::element( 'a', $addTopicButton['attributes'] + [
|
||||
'data-event-name' => 'talkpage.add-topic'
|
||||
], $addTopicButton['label'] );
|
||||
}
|
||||
|
||||
if ( $this->isSimplifiedTalkPageEnabled() && $this->canUseWikiPage() ) {
|
||||
|
|
|
@ -82,7 +82,7 @@ function initWatchstarCta( $watchstar ) {
|
|||
// prevent default to stop the user
|
||||
// being navigated to Special:UserLogin
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
// Don't stopProgation, as we want WikimediaEvents to log clicks to this.
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -110,13 +110,14 @@ module.exports = function ( mobile ) {
|
|||
ev.preventDefault();
|
||||
window.location.hash = '#' + encodedHeadlineId;
|
||||
|
||||
} );
|
||||
} ).attr( 'data-event-name', 'talkpage.section' );
|
||||
|
||||
// remove the `id` to avoid conflicts with the overlay route.
|
||||
// Without JS the id will still be present. With JS the overlay will open.
|
||||
$headline.removeAttr( 'id' );
|
||||
// however cache it to data for cooperation with the 'read as wiki page' button.
|
||||
$headline.data( 'id', headlineId );
|
||||
$headline.attr( 'data-event-name', 'talkpage.section' );
|
||||
|
||||
overlayManager.add( encodedHeadlineId, function () {
|
||||
return createTalkSectionOverlay( $heading, $headline, sectionId );
|
||||
|
@ -154,6 +155,7 @@ module.exports = function ( mobile ) {
|
|||
function renderReadAsWikiPageButton() {
|
||||
$( '<button>' )
|
||||
.addClass( 'minerva-talk-full-page-button' )
|
||||
.attr( 'data-event-name', 'talkpage.readAsWiki' )
|
||||
.text( mw.message( 'minerva-talk-full-page' ).text() )
|
||||
.on( 'click', function () {
|
||||
restoreSectionHeadings();
|
||||
|
|
Loading…
Reference in a new issue