mediawiki-extensions-Popups/src/ext.popups.referencePreviews/referencePreviews.js

22 lines
470 B
JavaScript
Raw Normal View History

let isTracking = false;
export const LOGGING_SCHEMA = 'event.ReferencePreviewsPopups';
/**
* Run once the preview is initialized.
*/
export function initReferencePreviewsInstrumentation() {
if ( mw.config.get( 'wgPopupsReferencePreviews' ) &&
navigator.sendBeacon &&
mw.config.get( 'wgIsArticle' ) &&
!isTracking
) {
isTracking = true;
mw.track( LOGGING_SCHEMA, { action: 'pageview' } );
}
}
export function isTrackingEnabled() {
return isTracking;
}