Skip to content
This repository has been archived by the owner. It is now read-only.

feat(metrics): measure page reloads by user #2455

Merged
merged 2 commits into from May 26, 2015
Merged

Conversation

@eoger
Copy link
Contributor

@eoger eoger commented May 21, 2015

Implementation draft for #2299

@eoger eoger force-pushed the issue-2299-measure-page-reloads branch from d4703c4 to ac610a1 May 21, 2015

if (refreshMetrics && refreshMetrics.url === currentPath) {
if (this._metrics) {
this._metrics.logEvent('refresh(' + currentPath + ')');

This comment has been minimized.

@vladikoff

vladikoff May 22, 2015
Contributor

  1. I don't think we have / support ( or ) in our metrics infrastructure.
  2. each view has a logScreenEvent (and a screen name) that you might find useful instead of this._window.location.pathname

This comment has been minimized.

@zaach

zaach May 22, 2015
Contributor

Yes, although you'd need access to the view in order to use those. It seems like this check might fit better in the router, in which case you would have access to the view.

@zaach
Copy link
Contributor

@zaach zaach commented May 22, 2015

We'll also need unit tests for reload check.

@eoger eoger force-pushed the issue-2299-measure-page-reloads branch from ac610a1 to 0fb35d9 May 22, 2015
@eoger
Copy link
Contributor Author

@eoger eoger commented May 22, 2015

I moved the logic to the router and also used the logScreenEvent method in View. Also added a test. As always feedback is appreciated :)

@@ -207,6 +209,27 @@ function (
return new View(viewOptions);
},

_checkForRefresh: function () {

This comment has been minimized.

@vladikoff

vladikoff May 22, 2015
Contributor

extra space above

This comment has been minimized.

@vladikoff

vladikoff May 22, 2015
Contributor

aka line breaks 👾


if (refreshMetrics && refreshMetrics.view === screenName) {
if (this.metrics) {
currentView.logScreenEvent('refresh');

This comment has been minimized.

@vladikoff

vladikoff May 22, 2015
Contributor

extra if statements above


refreshMetrics = {};
refreshMetrics.view = screenName;
refreshMetrics.timestamp = Date.now();

This comment has been minimized.

@vladikoff

vladikoff May 22, 2015
Contributor

nit: define this in a different way

refreshMetrics = {
   view: screenName,
   /// etc
}

This comment has been minimized.

@zaach

zaach May 22, 2015
Contributor

👍 for declarative style :D

@@ -340,6 +340,19 @@ function (chai, sinon, _, Backbone, Router, SignInView, SignUpView, ReadyView,
'screen.signup-complete'));
});
});

it('logs view refreshs', function () {

This comment has been minimized.

@vladikoff

vladikoff May 22, 2015
Contributor

typo: refreshes


var refreshMetrics = storage.get('last_page_loaded');

var currentView = this.currentView;

This comment has been minimized.

@vladikoff

vladikoff May 22, 2015
Contributor

nit: not sure we need 2 extra spaces above

@zaach
Copy link
Contributor

@zaach zaach commented May 22, 2015

It would be great to have a functional test for this, but currently we don't have a way to check metrics in functional tests. This could be worth investigating. Ref #1861.

@eoger eoger force-pushed the issue-2299-measure-page-reloads branch from 0fb35d9 to 29ede01 May 22, 2015
@eoger
Copy link
Contributor Author

@eoger eoger commented May 22, 2015

Thank you for your feedback guys, I will try to investigate how to include metrics in functional tests in the meantime.

@coveralls
Copy link

@coveralls coveralls commented May 22, 2015

Coverage Status

Coverage increased (+0.01%) to 98.26% when pulling 29ede01 on issue-2299-measure-page-reloads into 0860054 on master.

@zaach
Copy link
Contributor

@zaach zaach commented May 22, 2015

@eoger awesome!

var screenName = currentView.getScreenName();

if (refreshMetrics && refreshMetrics.view === screenName && this.metrics) {
currentView.logScreenEvent('refresh');

This comment has been minimized.

@shane-tomlinson

shane-tomlinson May 25, 2015
Member

Can you add this event to client-metrics.md under generic-events?

@shane-tomlinson
Copy link
Member

@shane-tomlinson shane-tomlinson commented May 25, 2015

Aside from my one nit, this looks great! I see the the new event during manual testing. All new lines are tested. Since @vladikoff and @zaach have been working with you through this, I defer to them for the final r.

@zaach
Copy link
Contributor

@zaach zaach commented May 26, 2015

👍 👍

zaach added a commit that referenced this pull request May 26, 2015
feat(metrics): measure page reloads by user
@zaach zaach merged commit 3634813 into master May 26, 2015
3 checks passed
3 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.01%) to 98.26%
Details
@zaach zaach deleted the issue-2299-measure-page-reloads branch May 26, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants