We have developed a solution to this problem in the SDK. It is disabled by default because it slightly changes how the user sessions are defined and tracked. You can enable this feature by changing the ping options.
You can read about how we define and track a user session in Google Analytics vs Bloomreach Engagement.
When you enable this feature, user sessions are tracked based on their activity on the website. By default, when the user visits a website, the SDK starts pinging our servers based on the configured interval. While the page is loaded, the SDK keeps pinging the servers regardless of whether the user is actually doing anything on the page. With user activity tracking enabled, the SDK only sends the session ping if the user performed one of the allowed user activity actions since the last session ping. If not, the SDK stops pinging and resumes once the user becomes active again.
When the SDK stops sending session pings, our backend server waits for 20 minutes and then generates a
session_end event. That means that with user activity enabled, if a user leaves running your website in a background browser tab, their session in Bloomreach Engagement will end and then a new one will start once they return to the page.
You can enable sessions based on user activity by setting
This takes any user action on the page as a valid user activity indicator. Alternatively, you can specify an object with keys
move set as
false to set which user actions are taken as indicators of user activity on the webpage. Any ommited keys are set to
click: true, // clicks are considered a user activity
move: false, // moving the mouse is not
scroll: false // and neither is scrolling on the page
// 'key' property is left as default, true, which means that pressing keys
// is considered a user activity
Updated 3 months ago