-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat:Time Spent on Page #341
Conversation
src/sessions/PageManager.ts
Outdated
@@ -165,6 +167,7 @@ export class PageManager { | |||
pageId, | |||
parentPageId: currentPage.pageId, | |||
interaction: currentPage.interaction + 1, | |||
parentTimeSpentOnPage: timeSpentOnParentPage, |
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: parentTimeSpentOnPage
-> timeSpentOnParentPage
src/sessions/PageManager.ts
Outdated
@@ -8,6 +8,7 @@ export type Page = { | |||
pageId: string; | |||
interaction: number; | |||
parentPageId?: string; | |||
parentTimeSpentOnPage?: number; |
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: parentTimeSpentOnPage
-> timeSpentOnParentPage
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.
agree. Added to the revision
thought: Since we cannot retrieve the last page's duration and we decided to not create a new form of page view, what about sending a page view event with |
Had thought about this. From what I know, I see three main issues with this approach:
|
question: How do we handle the case where the session is picked up from the cookie? For example, if user left the browser at page B, the web client may hold the "page.start" value in the cache, and when you move to subsequent pages, it may return an incorrect |
src/sessions/PageManager.ts
Outdated
@@ -136,6 +137,7 @@ export class PageManager { | |||
|
|||
private createNextPage(currentPage: Page, pageId: string) { | |||
let startTime = Date.now(); | |||
const timeOnParentPage = startTime - currentPage.start; |
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: timeOnParentPage
is more concise. Use timeOnParentPage
in the event schema instead of timeSpentOnParentPage
.
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.
updated in revision and schemas
src/sessions/PageManager.ts
Outdated
@@ -165,6 +167,7 @@ export class PageManager { | |||
pageId, | |||
parentPageId: currentPage.pageId, | |||
interaction: currentPage.interaction + 1, | |||
timeSpentOnParentPage: timeOnParentPage, |
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: What happens when the page is resumed?
We may want to change the behavior so that page view events are not recorded for resumed pages. RUM users have been confused by seeing users navigate from "PageA" to "PageA" in user journeys.
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.
Handled this case in revision. Page view events are no longer recorded for resumed pages if page ID is same. Start time from the Session cookie is used to compute the time on page if resumed page is different than when it was when session stopped.
src/sessions/PageManager.ts
Outdated
@@ -8,6 +8,7 @@ export type Page = { | |||
pageId: string; | |||
interaction: number; | |||
parentPageId?: string; | |||
timeSpentOnParentPage?: number; |
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: Is there a way we can omit timeOnParentPage
from this structure? This is stored on browser storage, so if we don't need it, we should omit it.
I feel like it's something we can compute during recordPageView()
.
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.
Fixed in revision. Now its done during recordPageView
Handled this in latest revision. The following change should handle the concerns you had:
|
Currently, AWS CloudWatch RUM does not record the time spent on a certain page. This change records the time spent on a page as part of the
parentTimeSpentOnPage
field in the page view event details. This field records the time spent on the parent page to the page view event it is recorded in.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.