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

Use pathname instead of URL for currentPath metrics parameter #9158

Merged
merged 1 commit into from
Aug 7, 2020

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Aug 7, 2020

The currentPath parameter passed to our metrics utility had been passed the full URL rather than just the path, contrary to what the name would imply. We only used the path portion, so passing the full URL did lead to complications.

Now just the pathname is passed in, rather than the full URL. This simplifies the metrics logic, and it incidentally fixes two bugs.

The main bug fixed is regarding Firefox metrics. Previously we had assumed the currentPath would start with chrome-extension://, which of course was not true on Firefox. This lead to us incorrectly parsing the currentPath, so path tracking was broken for Firefox events. This broken parsing is now bypassed entirely, so metrics should now work the same on Firefox as on Chrome.

The second bug was that we were incorrectly setting the tracking URL for background events during tests. As a result, we were incorrectly detecting ourselves as an internal site that had referred the user to us. But this was not of major concern, since it only affected test metrics (which get sent to the development Matomo project).

@Gudahtt
Copy link
Member Author

Gudahtt commented Aug 7, 2020

This depends upon #9157
#9157 has been merged

@Gudahtt Gudahtt force-pushed the use-pathname-instead-of-URL-for-current-path branch from 5ff290e to e7779dc Compare August 7, 2020 17:30
@Gudahtt Gudahtt force-pushed the remove-metrics-url-parameter branch from bc8031f to a4a276b Compare August 7, 2020 17:35
@Gudahtt Gudahtt force-pushed the use-pathname-instead-of-URL-for-current-path branch from e7779dc to 9cd049b Compare August 7, 2020 17:36
@metamaskbot
Copy link
Collaborator

Builds ready [9cd049b]
Page Load Metrics (608 ± 44 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint30119462311
domContentLoaded3367036069244
load3417046089244
domInteractive3357026069244

Base automatically changed from remove-metrics-url-parameter to develop August 7, 2020 17:57
The `currentPath` parameter passed to our metrics utility had been
passed the full URL rather than just the path, contrary to what the
name would imply. We only used the path portion, so passing the full
URL did lead to complications.

Now just the `pathname` is passed in, rather than the full URL. This
simplifies the metrics logic, and it incidentally fixes two bugs.

The main bug fixed is regarding Firefox metrics. Previously we had
assumed the `currentPath` would start with `chrome-extension://`, which
of course was not true on Firefox. This lead to us incorrectly parsing
the `currentPath`, so path tracking was broken for Firefox events.
This broken parsing is now bypassed entirely, so metrics should now
work the same on Firefox as on Chrome.

The second bug was that we were incorrectly setting the tracking URL
for background events during tests. As a result, we were incorrectly
detecting ourselves as an internal site that had referred the user to
us. But this was not of major concern, since it only affected test
metrics (which get sent to the development Matomo project).

Lastly, this change let us discard the `pathname` parameter used in
the `overrides` parameter of the `metricsEvent` function. Now that
`currentPath` is equivalent to `pathname`, the `pathname` parameter is
redundant.
@Gudahtt Gudahtt force-pushed the use-pathname-instead-of-URL-for-current-path branch from 9cd049b to 3faded6 Compare August 7, 2020 17:57
@Gudahtt Gudahtt marked this pull request as ready for review August 7, 2020 17:58
@Gudahtt Gudahtt requested a review from a team as a code owner August 7, 2020 17:58
@Gudahtt Gudahtt requested a review from tmashuang August 7, 2020 17:58
@metamaskbot
Copy link
Collaborator

Builds ready [3faded6]
Page Load Metrics (617 ± 19 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint287538105
domContentLoaded5657496164019
load5677506174119
domInteractive5657496164019

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

This makes sense!

@Gudahtt Gudahtt merged commit 1419c14 into develop Aug 7, 2020
@Gudahtt Gudahtt deleted the use-pathname-instead-of-URL-for-current-path branch August 7, 2020 18:32
Gudahtt added a commit that referenced this pull request Aug 7, 2020
)

The `currentPath` parameter passed to our metrics utility had been
passed the full URL rather than just the path, contrary to what the
name would imply. We only used the path portion, so passing the full
URL did lead to complications.

Now just the `pathname` is passed in, rather than the full URL. This
simplifies the metrics logic, and it incidentally fixes two bugs.

The main bug fixed is regarding Firefox metrics. Previously we had
assumed the `currentPath` would start with `chrome-extension://`, which
of course was not true on Firefox. This lead to us incorrectly parsing
the `currentPath`, so path tracking was broken for Firefox events.
This broken parsing is now bypassed entirely, so metrics should now
work the same on Firefox as on Chrome.

The second bug was that we were incorrectly setting the tracking URL
for background events during tests. As a result, we were incorrectly
detecting ourselves as an internal site that had referred the user to
us. But this was not of major concern, since it only affected test
metrics (which get sent to the development Matomo project).

Lastly, this change let us discard the `pathname` parameter used in
the `overrides` parameter of the `metricsEvent` function. Now that
`currentPath` is equivalent to `pathname`, the `pathname` parameter is
redundant.
Gudahtt added a commit that referenced this pull request Aug 10, 2020
* origin/master: (44 commits)
  Add category in eventOpts (#9164)
  Update changelog for v8.0.7 (#9161)
  Version v8.0.7
  Remove web3 e2e tests (#9159)
  Add web3 usage metrics, prepare for web3 removal (#9144)
  Use `pathname` instead of URL for `currentPath` metrics parameter (#9158)
  Remove `url` parameter from `metricsEvent` (#9157)
  Change MetaMetrics category for background events (#9155)
  remove .network-name height
  Use [email protected] (#9154)
  Update 'react-devtools' to ^4.8.0 (#9140)
  Fix connection removal bug (#9137)
  Add source map validator to CI (#9135)
  Update source map validator target files (#9133)
  Improve sourcemap validator console report (#9131)
  Add `validate-source-maps` npm script (#9134)
  Non-zero exit code upon failure to validate source maps (#9132)
  Update `brfs` from v1.6.1 to v2.0.2 (#9115)
  Factor out `getEnvironment` function in build script (#9114)
  Update `browserify` from v16.2.3 to v16.5.1 (#9113)
  ...
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.

3 participants