With current APIs, is there any way to measure how long a user has been interacting with the website (not just with a single page)?
That would be useful to decide when to trigger a push notification prompt, a newsletter signup prompt, etc. That would increase the likelihood that a website display the prompt at the right moment, after some interaction, and not as soon as a user lands on a website.
As far as I know, there is no single API that would directly tell you how long the user has interacted with a website as a whole, but there are different APIs that can be used together to enable a library that can answer that question more or less reliably.
Also note that the Idle Detection requires a permission, so it’s not suited for my use case: for example one of the use cases would be to ask the permission for notifications only once the user has interacted with the website for some time.
If you have privacy concern, the API could round the “interaction time” value… For example instead of saying that the user has interacted with a domain for 123.45 seconds, it could say > 1 minute.
The API would be really simple:
window.getDomainInteractionTime => number
or alternatively, window.getDomainEngagementLevel => ‘new’, ‘low’, ‘medium’, ‘high’, etc.
Then, based on the level of engagement, you can display personalized messages, push notification prompt, a newsletter signup prompt, etc…
“This is an average of the amount of time all visitors to a page spend on that particular page. This can be misleading as some people might leave the page open and go to lunch. But it is a pretty good reflection on how people are engaging with your content.”
2. Concept
3. What are we trying to measure?
The user has confirmation that loading has started.
The user has enough information in front of them to think that they can interact with the page.
The user can interact with the page (this particular moment being dependant of the type of the interaction).
The user’s interaction with the page is effortless and intuitive, with no delays and jank.
User Interaction With Forms
4. How Long Do Users Stay on Web Pages?
Summary: Users often leave Web pages in 10–20 seconds, but pages with a clear value proposition can hold people’s attention for much longer. To gain several minutes of user attention, you must clearly communicate your value proposition within 10 seconds.
5. My idea/Algorithm
Users often leave Web pages in 10–20 seconds
This statistical information should not be made with cookies, only localstorage
“One analysis of 5 million desktop and mobile pages found that the average time it takes to fully load a webpage is 10.3 seconds on desktop, and 27.3 seconds on mobile .” - this should be the maximum or minimum time for the function to measure user interaction time
It is necessary to specify the type of interaction that the user will make on the site
6. Source code of the my idea/algorithm
var info = userLeaveWebpage(); // website//mobile
localstorage.saveData(info)
// or
var website = userLeaveWebpage.mobile();
var mobile = userLeaveWebpage.website();
if website == 10 or website == 20:
userInteractTimeWebsite.form(10) // evaluate every 10 seconds if the user used the form or not in website
window.getDomainInteractionTime => number
//window.getDomainEngagementLevel => ‘new’, ‘low’, ‘medium’, ‘high
return localstorage.statusPage('true', '[10, 20]');
if website == 10 or website == 20:
window.getDomainInteractionTime => number
//window.getDomainEngagementLevel => ‘new’, ‘low’, ‘medium’, ‘high
userInteractTimeMobile.form(10) // evaluate every 10 seconds if the user used the form or not in mobile
return localstorage.statusPage('true', '[10, 20]');
The user will interact with some element of the page
For each element that the user interacts with the page, that element that was interacted with is evaluated for a time and the information of that time is saved in the information in localstorage or it can be sent to the server directly through a fetch
2. In short
My idea is to specify the form of user interaction at a time defined by the page
we can have user interaction in an email field or on page scrolling - this has to be set
In my code I do a time evaluation which is based on most page stats - with this I define which element I want to analyze in that time interval
For me to evaluate which element I need to analyze, it is necessary for the api to establish which elements should be evaluated
I made a suggestion like this: user interaction on the form, interaction waiting for the page to load etc.
How to measure user interaction time with the website?
Compare the page load response time with the time the page element is viewed, clicked, filled, or waited and waited.
The comparison will give you an average, a central value.
Frameworks like selenium do exactly what I said.
For you compare the page load response time with the time the page element is viewed, clicked, filled, or waited and waited. You need this: “Summary: Users often leave Web pages in 10–20 seconds, but pages with a clear value proposition can hold people’s attention for much longer. To gain several minutes of user attention, you must clearly communicate your value proposition within 10 seconds.”
To create our api to create an API that is made to interact in Dom - Document Object Model.
My api has everything you need.
My api:UserInteractionTime.js
var start=0, end;
function UserInteraction(nameDef, value){
localStorage.setItem(nameDef, value);
return localStorage.getItem(nameDef);
}
function UserInteractionForm(){
$('.eform input').on('focus', function(e){
start=Date.now()
})
$(document).on('submit','.eform', function(e){
end=Date.now()-start;
let number = start+end;
console.log("Seconds filling the form", parseFloat(end/1000).toFixed(2) )
UserInteraction("InteractionByForm", number)
});
}
function loadTime(){
return window.performance.timing.domContentLoadedEventEnd- window.performance.timing.navigationStart;
}