jitsu icon indicating copy to clipboard operation
jitsu copied to clipboard

Session Support for Pixel/SDK

Open azhard4int opened this issue 3 years ago • 5 comments

Problem

Currently, SDK sends page view events when the user loads a page/website, but one key information missing is sessions. Without sessions, we are missing to find out how long did the user use the web application before they closed the web page. What most of the applications are doing is they send a session_started event when the Dom is loaded and when the user exit the page, an event session_ended is sent.

Screenshot 2021-09-27 at 4 37 08 PM

Solution

Proposed solution: architecture, implementation details etc

  1. Provide an option on Pixel/SDK and make this it as an optional field: isSessionEnabled. By default the option is set to False.
  2. If the option isSessionEnabled is enabled, send a session_started event along with Page View. When the user is closing the tab, session_ended event can be triggered.

azhard4int avatar Sep 27 '21 13:09 azhard4int

@azhard4int we'll take a look. Probably that's something we can release mid-October.

However, I don't think session is a good description of this feature. Usually, sessions are a sequence of different page views that happens in a short time window (btw, we have DBT sessionazation package).

If we stick with following:

  • Add page_left event if shouldTrackPageLeft is set to true
  • Keep original page_view
  • Add secondsOnPage to page_left event

Will it solve your problem?

vklimontovich avatar Sep 28 '21 19:09 vklimontovich

@vklimontovich Thanks for getting back.

Yes, page_left event would be good enough to achieve the above functionality.

azhard4int avatar Sep 29 '21 05:09 azhard4int

@vklimontovich Is there any time line for page_left event, when it will be shipped?

azhard4int avatar Oct 22 '21 10:10 azhard4int

Hi @azhard4int! Not this month :( Maybe in December. Maybe it would make sense to implement that on your frontend? I believe this package will do the job: https://github.com/jasonzissman/TimeMe.js/

You can use Jitsu to send page_left/seconds_on_the_page

P. S. unfortunately, we can't use the same lib with Jitsu tracker due to bundle size constraints, and we'd need to implement our own version)

vklimontovich avatar Oct 25 '21 11:10 vklimontovich

@vklimontovich We are building our SaaS on top of Jitsu, if we were using for our own company/product, we could go with the option that you suggested.

So, we'll wait for this to be added in December or so.

azhard4int avatar Nov 08 '21 11:11 azhard4int