diff --git a/resources/dist/index.js b/resources/dist/index.js index 645e97b62..dd19b6fe0 100644 Binary files a/resources/dist/index.js and b/resources/dist/index.js differ diff --git a/resources/dist/index.js.map b/resources/dist/index.js.map index a5a3e948e..b03c9a67c 100644 Binary files a/resources/dist/index.js.map and b/resources/dist/index.js.map differ diff --git a/src/reducers/eventLogging.js b/src/reducers/eventLogging.js index 91a74841d..0b8065755 100644 --- a/src/reducers/eventLogging.js +++ b/src/reducers/eventLogging.js @@ -280,9 +280,9 @@ module.exports = function ( state, action ) { case actionTypes.SETTINGS_SHOW: return nextState( state, { - event: { + event: createEvent( state.interaction, { action: 'tapped settings cog' - } + } ) } ); default: diff --git a/tests/node-qunit/reducers/eventLogging.test.js b/tests/node-qunit/reducers/eventLogging.test.js index d121f0ea6..f6bf0392c 100644 --- a/tests/node-qunit/reducers/eventLogging.test.js +++ b/tests/node-qunit/reducers/eventLogging.test.js @@ -584,9 +584,39 @@ QUnit.test( 'PREVIEW_DWELL', function ( assert ) { } ); QUnit.test( 'SETTINGS_SHOW should enqueue a "tapped settings cog" event', function ( assert ) { - var state = { - interaction: {} - }; + var initialState = { + interaction: {} + }, + state, + token = '0123456789'; + + state = eventLogging( initialState, { + type: 'SETTINGS_SHOW' + } ); + + // Note well that this is a valid event. The "tapped settings cog" event is + // also logged as a result of clicking the footer link. + assert.deepEqual( + state.event, + { + action: 'tapped settings cog', + linkInteractionToken: undefined, + namespaceIdHover: undefined, + pageTitleHover: undefined + }, + 'It shouldn\'t fail if there\'s no interaction.' + ); + + // --- + + state = eventLogging( initialState, { + type: 'LINK_DWELL', + el: this.link, + title: 'Foo', + namespaceID: 1, + token: token, + timestamp: Date.now() + } ); state = eventLogging( state, { type: 'SETTINGS_SHOW' @@ -595,8 +625,12 @@ QUnit.test( 'SETTINGS_SHOW should enqueue a "tapped settings cog" event', functi assert.deepEqual( state.event, { - action: 'tapped settings cog' - } + action: 'tapped settings cog', + linkInteractionToken: token, + namespaceIdHover: 1, + pageTitleHover: 'Foo' + }, + 'It should include the interaction information if there\'s an interaction.' ); } );