mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 15:16:50 +00:00
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:
parent
1d1d46c95e
commit
82cdfcc55d
|
@ -52,7 +52,7 @@
|
|||
"bundlesize": [
|
||||
{
|
||||
"path": "resources/dist/index.js",
|
||||
"maxSize": "13.6KB"
|
||||
"maxSize": "13.61kB"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map.json
vendored
BIN
resources/dist/index.js.map.json
vendored
Binary file not shown.
|
@ -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'>
|
||||
|
|
Loading…
Reference in a new issue