From 35daa2a689f36f018ba34833a2123001d23747f1 Mon Sep 17 00:00:00 2001 From: Sam Smith Date: Wed, 21 Feb 2018 18:28:56 +0000 Subject: [PATCH] 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 --- extension.json | 2 +- resources/dist/index.js | Bin 37859 -> 37859 bytes resources/dist/index.js.json | Bin 325893 -> 325879 bytes src/actions.js | 8 ++++---- src/changeListeners/pageviews.js | 10 +++++----- src/index.js | 16 ++++++++-------- src/reducers/pageviews.js | 2 +- tests/node-qunit/actions.test.js | 4 ++-- .../changeListeners/pageviews.test.js | 18 +++++++++--------- tests/node-qunit/reducers/pageviews.test.js | 8 ++++---- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/extension.json b/extension.json index a04af34b4..8cb85e638 100644 --- a/extension.json +++ b/extension.json @@ -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, diff --git a/resources/dist/index.js b/resources/dist/index.js index 2c3d2d4008958ad3ad06f28a0ab63e8614e68890..33fb90a315dbfe84f1b191c4c4dab26e59d33a99 100644 GIT binary patch delta 30 mcmaF7oaym$rVTM#jAff+wVrXXlx3!tPhM}Pxw*i&H~|34W(;=# delta 30 mcmaF7oaym$rVTM#jA5H&wVrXXgk`3dPhM}Pxw*i&H~|30MhrIq diff --git a/resources/dist/index.js.json b/resources/dist/index.js.json index 1bd92b6ac03440d8583bd38c52edcc59efd37f2b..7461ffac1e705c57c63094d6aef973af181c9dd4 100644 GIT binary patch delta 569 zcmZquB>erO@PtI+WV5tX3kxH|loV47%j8r8OGA^%4;iI4_B9AFmTl%2>|+5^^F+74 zkSNPcE%(V!PftyWQHoWtRVYYIPX&ohRb&*|T>o#i#&&IWMq8%o@-fV}rvHjzPM;pb z$;inHR2LQl8cZ&bSDL;c zf{APT>YI%G+lB5iCNaY;GM&EmA>$;VVGfTNH?RTek1rVAn1Hm!YsUY~(=FaJDgrrC z?-|Wmf%HXo7G1{e`@b@_=1liaWO=jQFqtWC1GXTVE-uczW3%23L8k55V$AEEw@XJc zGb6lS4fG1o$Ewo}9GTg+FN|fbRD(MS;rC*!{+x6*Xm3TCIt^-Mg|*Qc=XOc$8U zEDhr+OuzqxnRWZEHs<5GctWR#4Q?YW5T*kIL1TOAALbLF5CDe6ZN}-6j4U2NX8?nv kc>7gG76T?|m`n$T$;RzBSy;Y<)B*#hGIBdGNOnyJ05F)*wg3PC delta 567 zcmaKp&r4KM6vz3#bF~R4dc$NRw&)p@I%1@gFM^CDh!EE=M^omFO^={7C@5Mu1tl%a zVum`j389F7Krjt)`VZRGR>n595*$b)kg&w_dPJLQb?*7zdwzUBcWpI!>ud6!pLF|r z{eqk6$+(AoH}B>r4xBB2LThF2x(%NeSt*`hK#ae9M4XEyD<+dQ zU`sS0#dp@Js^@_p)FBg}ak~+o)R%C=QqhCCBu|$yOWNr>nKspS8B>vl70jqznf->> z7u3zsyfs+)8zHt+^tQTxAz^WAhWg~;PP%qHvfl#k8l`3J{D(onxpA@^egPAO@nm1L zW=X?;-23IC73UW-6z30zsEO?|*`XvV)pfsrQ8-BQbB(T2G~_o6Q5Gv|Kg6&I-Uf40 i6J_x@{ICdvD28WR7ZT`(tj5gHuwE*Mx^(8v`v;qjk-fwK diff --git a/src/actions.js b/src/actions.js index 04970fc61..18d33a057 100644 --- a/src/actions.js +++ b/src/actions.js @@ -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 }; diff --git a/src/changeListeners/pageviews.js b/src/changeListeners/pageviews.js index 26785e0d9..94da4418e 100644 --- a/src/changeListeners/pageviews.js +++ b/src/changeListeners/pageviews.js @@ -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(); } }; } diff --git a/src/index.js b/src/index.js index 8169aab01..0f7eb4ae8 100644 --- a/src/index.js +++ b/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 ); diff --git a/src/reducers/pageviews.js b/src/reducers/pageviews.js index 5f9b4acb9..9c639143c 100644 --- a/src/reducers/pageviews.js +++ b/src/reducers/pageviews.js @@ -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 * diff --git a/tests/node-qunit/actions.test.js b/tests/node-qunit/actions.test.js index 89c190d94..ae01cdd17 100644 --- a/tests/node-qunit/actions.test.js +++ b/tests/node-qunit/actions.test.js @@ -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' ); } ); } ); diff --git a/tests/node-qunit/changeListeners/pageviews.test.js b/tests/node-qunit/changeListeners/pageviews.test.js index 49b770394..08f096002 100644 --- a/tests/node-qunit/changeListeners/pageviews.test.js +++ b/tests/node-qunit/changeListeners/pageviews.test.js @@ -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' ); } ); diff --git a/tests/node-qunit/reducers/pageviews.test.js b/tests/node-qunit/reducers/pageviews.test.js index 4ab9214e7..4e8b2571a 100644 --- a/tests/node-qunit/reducers/pageviews.test.js +++ b/tests/node-qunit/reducers/pageviews.test.js @@ -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 },