Don't record Popups actions on non-content pages

We found that Popups was overcounted approximately 2.5x relative to Cite.
This patch attempts to nearly match the circumstances under which Cite
(and its tracking) is loaded.

Bug: T214493
Change-Id: Ib31df3c33879f4ea63d9808ffd260861069a8977
This commit is contained in:
Adam Wight 2019-11-12 16:18:12 +01:00
parent 1d1d46c95e
commit 82cdfcc55d
4 changed files with 9 additions and 6 deletions

View file

@ -52,7 +52,7 @@
"bundlesize": [
{
"path": "resources/dist/index.js",
"maxSize": "13.6KB"
"maxSize": "13.61kB"
}
]
}

Binary file not shown.

Binary file not shown.

View file

@ -9,9 +9,14 @@ import { escapeHTML } from '../templateUtil';
const KNOWN_TYPES = [ 'book', 'journal', 'news', 'web' ];
const LOGGING_SCHEMA = 'event.ReferencePreviewsPopups';
$( function () {
if ( mw.config.get( 'wgPopupsReferencePreviews' ) ) {
let isTracking = false;
$( () => {
if ( mw.config.get( 'wgPopupsReferencePreviews' ) &&
navigator.sendBeacon &&
mw.config.get( 'wgIsArticle' ) &&
!isTracking
) {
isTracking = true;
mw.track( LOGGING_SCHEMA, { action: 'pageview' } );
}
} );
@ -35,8 +40,6 @@ export function renderReferencePreview(
url = escapeHTML( model.url ),
linkMsg = escapeHTML( mw.msg( 'popups-refpreview-jump-to-reference' ) );
const isTracking = navigator.sendBeacon && mw.eventLog;
const $el = renderPopup( model.type,
`
<strong class='mwe-popups-title'>