Extracting Current Session ID

I am trying to identify and attract the ID of my current session, but it doesn’t appear that the session id is being set. I am new to an existing tracker setup so is it possible that the session tracking was not set up? I see the capability to configure the session cookie duration, but is there some configuration that needs to be set to enable session identification?

Here is the result of calling .getDomainUserInfo:

It appears that it is missing a sixth value.

@cphillips, at least one event should have fired before you check the session ID. I suspect that if you call getDomainUserInfo before any Snowplow event fires you will get that result.

I don’t believe that is the case because this is grabbed after pageview is loaded and when I check the Query String Parameters of subsequent events after the page load I notice that the sid is missing from the pixels.

Can you post your initialisation snippet here? If there’s an issue there it’s possible the cookie (and session) isn’t being set.

@mike code is provided below. I have a similar belief.

const snowplow = {
  init() {
    (function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[];
    p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments)
    };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
    n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//*id*.cloudfront.net/2.4.2/sp.js","snowplow"));

    var collectorUrls = ["events.fivetran.com/snowplow/*id*"];
    var trackingOptions = { appId: '*id*', cookieDomain: null };

    collectorUrls.forEach(function(collectorUrl, index) {
    var trackerNamespace = 'javascript:marketing';
    window.snowplow('newTracker', trackerNamespace, collectorUrl, trackingOptions);
    });

    window.snowplow('enableActivityTracking', 30, 10);
    window.snowplow('trackPageView');
  }
}

export default snowplow;

Hi @cphillips

I suspect a lot of the issues you are running into are to do with running the Fivetran Snowplow infrastructure rather than the mainstream Snowplow.

The managed service that Fivetran runs Snowplow on is several years old (for example the Javascript collector version is 3.5 years old), has some bugs and doesn’t support the same feature set as running the modern version of Snowplow.

I’d recommend either running Snowplow Insights (managed service) or Snowplow open source instead as this will allow you to run the latest version of all the infrastructure including the Javascript tracker (latest version 2.9.2) which will likely fix a lot of the problems.

1 Like

This is good to know. Was there anything that stood out from the code provided that might point to anything misconfigured? (Session timeout?) Or do you think it is purely the age of the snowplow tracker that we are using?

Not immediately but the age of the Snowplow tracker is likely to have something to do with it. There’s been some significant updates (including bugfixes) since that version so it’d be hard to compare behaviour directly.