-
Notifications
You must be signed in to change notification settings - Fork 25
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
#1785 Logging when Audit page and Validation page are visible #2222
Conversation
…Sidewalk/SidewalkWebpage into 1785-log-page-visibility
@misaugstad I just wanted to let you know that, from my testing, I found that the visibilitychange event listener triggers whenever the webpage is fully obscured from view (e.g. when the user goes into another browser tab, hides the entire browser behind another application, or enters a different desktop), but not if any part of the webpage is visible (e.g. the user fills the screen with applications but the corner of the webpage is still barely visible). |
@shokiami do you know if there are alternatives that also take into account if the browser is partially hidden. Or is just out of focus is what we are really looking for. |
Like what you have sounds good, I would just expect there to be a way to know if our browser window is in focus or not |
@misaugstad |
I think the only change I would want would be to include whether it is now in/out of focus in the action name instead of the note. |
@misaugstad What do you think? |
@@ -176,6 +176,13 @@ function Main (params) { | |||
} | |||
svl.popUpMessage = new PopUpMessage(svl.form, svl.storage, svl.taskContainer, svl.tracker, svl.user, svl.onboardingModel, svl.ui.popUpMessage); | |||
|
|||
// Logs when the webpage's visiblity changes. |
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.
When you first add the event listeners, can you first do a check for whether the page is in/out of focus and log that?
@@ -176,6 +176,13 @@ function Main (params) { | |||
} | |||
svl.popUpMessage = new PopUpMessage(svl.form, svl.storage, svl.taskContainer, svl.tracker, svl.user, svl.onboardingModel, svl.ui.popUpMessage); | |||
|
|||
// Logs when the webpage's visiblity changes. | |||
window.addEventListener("focus", function(event) { | |||
svl.tracker.push("GainedFocus") |
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.
Can you change it to PageGainedFocus and PageLostFocus
Do you know if this works on mobile? |
Then can you edit this wiki page with the appropriate checkmark or X for mobile use? |
@misaugstad |
I'm assuming you're using an iPhone? I am as well and am getting the same bug. Seems to be a webkit bug so it is not on us. I think the only issue I found with your code was that the first PageGainedFocus log on the validation page has the mission_id as null. So I think you just want to wait to add the listeners and do that initial check for page focus until the mission id has been initialized. Working well on the audit page! |
@misaugstad How does that look? |
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.
Looks good!
Resolves #1785
This PR makes it so that any visibility change of the audit and validation page are logged to the database.
Audit Task Interaction Table Example Entries:
Validation Task Interaction Table Example Entries: