Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event logging update #212

Merged
merged 13 commits into from
Mar 25, 2019
Merged

Event logging update #212

merged 13 commits into from
Mar 25, 2019

Conversation

scottsfarley93
Copy link

@scottsfarley93 scottsfarley93 commented Mar 15, 2019

This PR updates the interaction logging first introduced in #183 in the following ways:

  • place_name and id are included with selection events so that these events can be more easily consumed by search engine updates

  • a new keyevent event is introduced. This event will be sent on each keydown event -- these anonymous events will be used to further improve relevance computation in the core search engine.

  • events are batched together to minimize network calls

  • briefly describe the changes in this PR

  • write tests for all new functionality

  • update CHANGELOG.md with changes under master heading before merging

@scottsfarley93 scottsfarley93 added this to the v4.0.0 milestone Mar 18, 2019
//pass invalid event
if (!keyEvent.key) return;
// don't send events for keys that don't change the input
if (keyEvent.metaKey || [9, 27, 37, 39, 13, 38, 40].indexOf(keyEvent.keyCode) !== -1) return;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment with the actual keys that these codes correspond to

lib/events.js Outdated
if (err) return this.handleError(err, callback);
if (res.statusCode != 204) return this.handleError(res, callback);
if (err) return _this.handleError(err, callback);
if (res.statusCode != 204) return _this.handleError(res, callback);
if (callback) return callback();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicative of line 104 in that callback is populated if it is falsy. Line 104 should be removed.

lib/events.js Outdated
if (err) return this.handleError(err, callback);
if (res.statusCode != 204) return this.handleError(res, callback);
if (err) return _this.handleError(err, callback);
if (res.statusCode != 204) return _this.handleError(res, callback);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to use arrow functions? If possible let's switch this to an arrow function to avoid the rescope of this and avoid having to use _this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No arrow functions here just now -- perhaps in a future sprint we can bring support for arrow functions.

In lieu of arrow functions, however, I added a bind(this) so we don't need to create a temporary _this variable.

* @param {Function} callback the function to execute after the events have been sent successfully
* @private
*/
flush: function(){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JS Doc says this function should have a callback param

@scottsfarley93 scottsfarley93 changed the title [WIP] Additional event logging Event logging update Mar 25, 2019
@ingalls
Copy link

ingalls commented Mar 25, 2019

🌮

@scottsfarley93 scottsfarley93 merged commit 4431b04 into version4 Mar 25, 2019
@scottsfarley93 scottsfarley93 mentioned this pull request Apr 17, 2019
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants