Duplicated _sp_id cookie

I have recently noticed when inspecting cookies that there are two _sp_id's. Is it meant to be like that? Couldn’t find anything in the docs on this.

Can you also explain what the .xxxx variants mean?

Screenshot 2021-04-29 at 17.22.03

The .xxx part is a hash of the domain. You can read more about it at How the tracker stores state - Snowplow Docs

In this case, these are two separate ID cookies for two different domains

1 Like

This will be down to the fact that there can be more than one Snowplow tracker on the page. If two distinct trackers with different namespaces are initialised, they’ll each create an sp_id cookie. If we consider that they can have distinct configurations (eg for sessionisation), this makes sense.

The suffix is simply a hash value to avoid collisions when we have multiple trackers.

In general, there are three likely reasons for finding two cookies:

  1. Some other tool you use on the page also has Snowplow embedded. The third party use case is the main reason this behaviour exists.

  2. At some point, your tracker namespace changed, and therefore the cookie id changed.

  3. There are currently two distinct trackers initialised somewhere in your code.

Our partners at Poplin maintain a Chrome extention that would be handy in ascertaining whether 1 or 3 is the case.

To test if 2 is the case, delete both cookies locally, then reload the page. If this results in just one cookie, then 2 is likely the explanation.

This can also be caused by misconfiguration of tracker where it will drop new cookie on a subdomain.
You can check “domain” column for those cookies. If you see cookie set for top level domian and subdomains - you may need to adjust how snowplow sets the cookie (I belive this should not be a problem with more recent Snowplow versions as they should autodiscover root domain, but I am not sure which version you are using).

1 Like