-
Notifications
You must be signed in to change notification settings - Fork 142
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
⚗ Collect scroll metrics #2180
⚗ Collect scroll metrics #2180
Conversation
packages/rum-core/src/domain/rumEventsCollection/view/trackScrollMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackScrollMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackScrollMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackScrollMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackScrollMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/viewCollection.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/viewCollection.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackScrollMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackScrollMetrics.ts
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #2180 +/- ##
==========================================
+ Coverage 94.17% 94.22% +0.05%
==========================================
Files 205 206 +1
Lines 6144 6180 +36
Branches 1361 1368 +7
==========================================
+ Hits 5786 5823 +37
+ Misses 358 357 -1
... and 3 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
ece7985
to
e33b0b4
Compare
packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/viewCollection.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.ts
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.ts
Outdated
Show resolved
Hide resolved
// We compute scroll metrics at loading time to ensure we have scroll data when loading the view initially | ||
// This is to ensure that we have the depth data even if the user didn't scroll or if the view is not scrollable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ question: a fair amount of views don't have loading time, could it be bothering to not have scroll information for those views?
why not doing it at init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really a problem to not have scroll information for all the views, we can consider that this information is saved only when the user has spent enough time on the view (i.e. it has at least finished loading). Loading time is intersting because the page has usually reached a state where metrics like the scroll height are stable. It's true that it's not 100% reliable though, we sometimes send values before the page is fully loaded (See how small the scroll height can be here)
scrollMetrics = { | ||
maxScrollHeight: scrollHeight, | ||
maxScrollDepth: scrollDepth, | ||
maxScrollDepthTime: newLoadingTime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ question: why maxScrollDepthTime
should be related to loadingTime
in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of explain this in my previous comment, I think it's not ideal because the page is often not fully loaded at "loading time" I'm open to suggestions on how to improve this
packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for replay
2248eb3
to
9466bea
Compare
packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/view/trackViewMetrics.ts
Outdated
Show resolved
Hide resolved
export function trackScrollMetrics( | ||
viewStart: ClocksState, | ||
callback: (scrollMetrics: ScrollMetrics) => void, | ||
getScrollMetrics = computeScrollValues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: reinforce naming and avoid confusion with the other getScrollMetrics
getScrollMetrics = computeScrollValues | |
getScrollValues = computeScrollValues |
Motivation
We want to track scoll metrics.
RFC: https://docs.google.com/document/d/1_5wSVrqVD6_UF93Pag3xQYlFUDeTwVHS5BJb78RjZb4/edit?tab=t.0#heading=h.rnd972k0hiye
Changes
trackViews
to add scroll metricsTesting
This PR is not production ready yet, it's intended to deploy it to staging first
I have gone over the contributing documentation.