mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-11 16:58:14 +00:00
Hygiene: Page view -> Pageview
Pageview is consistent with verbiage used by Research and Analytics Engineering in their reports and documentation, e.g. https://wikitech.wikimedia.org/wiki/Analytics/Pageviews. Bug: T184793 Change-Id: I8ae085b4af85aa72f234f3db27f0cac2c4d014e5
This commit is contained in:
parent
ea2c0d71ea
commit
35daa2a689
|
@ -57,7 +57,7 @@
|
|||
"VirtualPageView": 17737148
|
||||
},
|
||||
"config": {
|
||||
"@PopupsVirtualPageViews": "@var bool: Whether the extension should log virtual page views.",
|
||||
"@PopupsVirtualPageViews": "@var bool: Whether the extension should log virtual pageviews.",
|
||||
"PopupsVirtualPageViews": false,
|
||||
"@PopupsBetaFeature": "@var bool: Whether the extension should be enabled as an opt-in beta feature. If true, the BetaFeatures extension must be installed. False by default.",
|
||||
"PopupsBetaFeature": false,
|
||||
|
|
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.json
vendored
BIN
resources/dist/index.js.json
vendored
Binary file not shown.
|
@ -306,7 +306,7 @@ export function previewShow( token ) {
|
|||
currentToken = preview && preview.activeToken;
|
||||
|
||||
if (
|
||||
// Check the page view can still be associated with original event
|
||||
// Check the pageview can still be associated with original event
|
||||
currentToken && currentToken === token &&
|
||||
// and the preview is still active and of type `page`
|
||||
fetchResponse && fetchResponse.type === 'page'
|
||||
|
@ -316,7 +316,7 @@ export function previewShow( token ) {
|
|||
title: fetchResponse.title,
|
||||
// The existing version of summary endpoint does not
|
||||
// provide namespace information, but new version
|
||||
// will. Given we only show page views for main namespace
|
||||
// will. Given we only show pageviews for main namespace
|
||||
// this is hardcoded until the newer version is available.
|
||||
namespace: 0
|
||||
} );
|
||||
|
@ -326,12 +326,12 @@ export function previewShow( token ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Represents the situation when a page view has been logged
|
||||
* Represents the situation when a pageview has been logged
|
||||
* (see previewShow and PREVIEW_SEEN action type)
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
export function pageViewLogged() {
|
||||
export function pageviewLogged() {
|
||||
return {
|
||||
type: types.PAGEVIEW_LOGGED
|
||||
};
|
||||
|
|
|
@ -10,23 +10,23 @@
|
|||
* deliver logged events.
|
||||
*
|
||||
* @param {Object} boundActions
|
||||
* @param {EventTracker} pageViewTracker
|
||||
* @param {EventTracker} pageviewTracker
|
||||
* @param {String} referrer url
|
||||
* @return {ext.popups.ChangeListener}
|
||||
*/
|
||||
export default function pageviews(
|
||||
boundActions, pageViewTracker, referrer
|
||||
boundActions, pageviewTracker, referrer
|
||||
) {
|
||||
return function ( _, state ) {
|
||||
if ( state.pageviews && state.pageviews.pageview ) {
|
||||
pageViewTracker( 'event.VirtualPageView', $.extend( {},
|
||||
pageviewTracker( 'event.VirtualPageView', $.extend( {},
|
||||
{
|
||||
referrer: referrer
|
||||
},
|
||||
state.pageviews.pageview )
|
||||
);
|
||||
// Clear the page view now its been logged.
|
||||
boundActions.pageViewLogged();
|
||||
// Clear the pageview now its been logged.
|
||||
boundActions.pageviewLogged();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
16
src/index.js
16
src/index.js
|
@ -67,7 +67,7 @@ function getStatsvTracker( user, config, experiments ) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the appropriate analytics event tracker for logging virtual page views.
|
||||
* Gets the appropriate analytics event tracker for logging virtual pageviews.
|
||||
*
|
||||
* @param {Object} config
|
||||
* @return {EventTracker}
|
||||
|
@ -125,12 +125,12 @@ function getCurrentTimestamp() {
|
|||
* @param {PreviewBehavior} previewBehavior
|
||||
* @param {EventTracker} statsvTracker
|
||||
* @param {EventTracker} eventLoggingTracker
|
||||
* @param {EventTracker} pageViewTracker
|
||||
* @param {EventTracker} pageviewTracker
|
||||
* @param {Function} getCurrentTimestamp
|
||||
*/
|
||||
function registerChangeListeners(
|
||||
store, actions, userSettings, settingsDialog, previewBehavior,
|
||||
statsvTracker, eventLoggingTracker, pageViewTracker, getCurrentTimestamp
|
||||
statsvTracker, eventLoggingTracker, pageviewTracker, getCurrentTimestamp
|
||||
) {
|
||||
registerChangeListener( store, changeListeners.footerLink( actions ) );
|
||||
registerChangeListener( store, changeListeners.linkTitle() );
|
||||
|
@ -147,7 +147,7 @@ function registerChangeListeners(
|
|||
actions, eventLoggingTracker, getCurrentTimestamp
|
||||
) );
|
||||
registerChangeListener( store,
|
||||
changeListeners.pageviews( actions, pageViewTracker, window.location.href )
|
||||
changeListeners.pageviews( actions, pageviewTracker, window.location.href )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ mw.requestIdleCallback( function () {
|
|||
userBucket,
|
||||
store,
|
||||
boundActions,
|
||||
pageViewTracker,
|
||||
pageviewTracker,
|
||||
|
||||
// So-called "services".
|
||||
generateToken = mw.user.generateRandomSessionId,
|
||||
|
@ -187,8 +187,8 @@ mw.requestIdleCallback( function () {
|
|||
settingsDialog = createSettingsDialogRenderer();
|
||||
experiments = createExperiments( mw.experiments );
|
||||
statsvTracker = getStatsvTracker( mw.user, mw.config, experiments );
|
||||
// Virtual page views are always tracked.
|
||||
pageViewTracker = getPageViewTracker( mw.config );
|
||||
// Virtual pageviews are always tracked.
|
||||
pageviewTracker = getPageViewTracker( mw.config );
|
||||
eventLoggingTracker = getEventLoggingTracker(
|
||||
mw.user,
|
||||
mw.config,
|
||||
|
@ -217,7 +217,7 @@ mw.requestIdleCallback( function () {
|
|||
registerChangeListeners(
|
||||
store, boundActions, userSettings, settingsDialog,
|
||||
previewBehavior, statsvTracker, eventLoggingTracker,
|
||||
pageViewTracker,
|
||||
pageviewTracker,
|
||||
getCurrentTimestamp
|
||||
);
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import nextState from './nextState';
|
|||
|
||||
/**
|
||||
* Reducer for actions that queues and clears events for
|
||||
* being logged as virtual page views [0]
|
||||
* being logged as virtual pageviews [0]
|
||||
*
|
||||
* [0]: https://meta.wikimedia.org/wiki/Schema:VirtualPageViews
|
||||
*
|
||||
|
|
|
@ -507,7 +507,7 @@ QUnit.test( 'it should dispatch the PREVIEW_SHOW action and log a pageview', fun
|
|||
assert.strictEqual(
|
||||
this.wait.getCall( 0 ).args[ 0 ],
|
||||
1000,
|
||||
'It waits for PAGE_VIEW_VISIBILITY_DURATION milliseconds before trigging a pageview.'
|
||||
'It waits for PAGEVIEW_VISIBILITY_DURATION milliseconds before trigging a pageview.'
|
||||
);
|
||||
return previewShow.then( function () {
|
||||
assert.ok(
|
||||
|
@ -520,7 +520,7 @@ QUnit.test( 'it should dispatch the PREVIEW_SHOW action and log a pageview', fun
|
|||
namespace: 0,
|
||||
title: 'A'
|
||||
} ),
|
||||
'Dispatches virtual page view'
|
||||
'Dispatches virtual pageview'
|
||||
);
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -5,13 +5,13 @@ var REFERRER = 'https://en.m.wikipedia.org/wiki/Kittens';
|
|||
QUnit.module( 'ext.popups/pageviews', {
|
||||
beforeEach: function () {
|
||||
this.boundActions = {
|
||||
pageViewLogged: this.sandbox.spy()
|
||||
pageviewLogged: this.sandbox.spy()
|
||||
};
|
||||
|
||||
this.pageViewTracker = this.sandbox.spy();
|
||||
this.pageviewTracker = this.sandbox.spy();
|
||||
this.changeListener = pageviews(
|
||||
this.boundActions,
|
||||
this.pageViewTracker,
|
||||
this.pageviewTracker,
|
||||
REFERRER
|
||||
);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ QUnit.test( 'it should log the queued event', function ( assert ) {
|
|||
this.changeListener( undefined, state );
|
||||
|
||||
assert.ok(
|
||||
this.pageViewTracker.calledWith(
|
||||
this.pageviewTracker.calledWith(
|
||||
'event.VirtualPageView',
|
||||
{
|
||||
title: 'Rainbows',
|
||||
|
@ -47,8 +47,8 @@ QUnit.test( 'it should log the queued event', function ( assert ) {
|
|||
'Event is logged verbatim'
|
||||
);
|
||||
assert.ok(
|
||||
this.boundActions.pageViewLogged.called,
|
||||
'When logged an action is taken to unqueue the page view'
|
||||
this.boundActions.pageviewLogged.called,
|
||||
'When logged an action is taken to unqueue the pageview'
|
||||
);
|
||||
} );
|
||||
|
||||
|
@ -58,11 +58,11 @@ QUnit.test( 'it should not log something that is not a pageview', function ( ass
|
|||
this.changeListener( undefined, state );
|
||||
|
||||
assert.notOk(
|
||||
this.pageViewTracker.called,
|
||||
'No page view tracked'
|
||||
this.pageviewTracker.called,
|
||||
'No pageview tracked'
|
||||
);
|
||||
assert.notOk(
|
||||
this.boundActions.pageViewLogged.called,
|
||||
this.boundActions.pageviewLogged.called,
|
||||
'No action taken'
|
||||
);
|
||||
} );
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pageviews from '../../../src/reducers/pageviews';
|
||||
|
||||
var PAGE_VIEW = {
|
||||
var PAGEVIEW = {
|
||||
title: 'Bears',
|
||||
namespace: 0
|
||||
};
|
||||
|
@ -25,9 +25,9 @@ QUnit.test( 'PREVIEW_SEEN', function ( assert ) {
|
|||
assert.deepEqual(
|
||||
pageviews( this.initialState, action ),
|
||||
{
|
||||
pageview: PAGE_VIEW
|
||||
pageview: PAGEVIEW
|
||||
},
|
||||
'It should set a flag requesting a page view is recorded.'
|
||||
'It should set a flag requesting a pageview is recorded.'
|
||||
);
|
||||
} );
|
||||
|
||||
|
@ -39,7 +39,7 @@ QUnit.test( 'PAGEVIEW_LOGGED', function ( assert ) {
|
|||
assert.expect( 1 );
|
||||
|
||||
assert.deepEqual(
|
||||
pageviews( { pageview: PAGE_VIEW }, action ),
|
||||
pageviews( { pageview: PAGEVIEW }, action ),
|
||||
{
|
||||
pageview: undefined
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue