Open denisov-vlad opened 2 years ago
I don't think it's particularly well documented but the first bullet point already exists, you can call the newSession
method to start a new session.
Or window.snowplow('newSession')
if using the JavaScript Tracker rather than Browser Tracker.
I'll leave this issue open for the option to reset on UTM param change and/or new referer. That would perhaps be a breaking change though, or need to be disabled by default.
@paulboocock Thanks! That's exactly what I need.
But there is one issue with newSession
usage from code when session timeout happens:
newSession
before trackPageView
(vid = 26)If you wait for the session to timeout and then visit the page, that's going to generate vid 25 immediately because that's a new session. Track Page View isn't when the session begins, when you arrive on the page and initialise the tracker is when the session starts.
In reality there are usually lots of edge cases when vid doesn't increase by only 1, it should be used to sort sessions in order, not to get a count of them (you should count by distinct domain_sessionid
for that).
Is your feature request related to a problem? Please describe. According to GA documentation it starts new session if referrer isn't equal URL domain or URL has UTM-params. It would be helpful to have the same logic inside Snowplow.
Describe the solution you'd like
Thanks!