New domain_sessionid being generated for each page_view event

Hi,

I am using the Javascript Tracker. My understanding is that a new domain_sessionid is created for a visitor every 30 minutes (source), but every time I refresh a page (or for every page_view event), a new domain_sessionid is being sent by the tracker.

While on the same page, events such as page_ping, unstruct etc use the same domain_sessionid that was created when the page was loaded.

How can I maintain the same domain_sessionid for 30 minutes?

It looks like not storing local user information in cookie/browser storage. Please verify cookie domain and cookie path you set in constructor.

1 Like

Hi @grzegorzewald

I have set the cookie domain and I have not set the cookie path. I think the snowplow session cookies should be set by default by the JS tracker. In the default case, their names are “_sp_id” and “_sp_ses” respectively.

I also checked document.cookie and did not see anything set by the name of _sp_id or _sp_ses
What am I missing here?

You should only need to set the cookie domain according to the URL you’re requesting from and it should work fine. Can you post your initialisation?

@mike

window.snowplow('newTracker', 'cf', 'track.popxo.com', { // Initialise a tracker
      appId: 'popxo-web',
      cookieDomain: 'www.popxo.com',
 });

Your production site is using version 2.5.1 of the Javascript tracker which is a few years old. You should use the latest version (2.8.2) either self hosted or via Cloudfront and I suspect that will fix the problem.

HI @mike
I tried that in my dev environment. Did not fix the problem

What’s the URL of the site in dev?

@mike

mp.de

@mike

I changed the cookie domain in my local environment and it works. Thanks a lot Mike :slight_smile:

If you’re testing locally you’ll need to set the cookieDomain to that then.

Note you should use .popxo.com as cookie domain rather than www.popxo.com.