Ghost sessions
You might notice that some of your users have short empty sessions randomly generated without any other user activity. In our experience, this happens when the user leaves your website running in a background browser tab and their computer falls asleep. The computer might then intermittently wake up to perform some work (Macbooks even have a setting for this), which also wakes up the browser and the Javascript SDK running in the background tab sends a session ping to our backend, which tracks a short empty session in Bloomreach Engagement.
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.
User activity
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.
Configuration
You can enable sessions based on user activity by setting ping.activity
to true
:
exponea.start({
ping: {
activity: true
}
})
This takes any user action on the page as a valid user activity indicator. Alternatively, you can specify an object with keys click
, key
, scroll
, move
set as true
or false
to set which user actions are taken as indicators of user activity on the webpage. Any ommited keys are set to true
:
exponea.start({
ping: {
activity: {
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 12 months ago