Collecting data with Trackers and Webhooks

  1. Home
  2. Docs
  3. Collecting data with Trackers and Webhooks
  4. Trackers – collecting data from your own applications
  5. JavaScript Trackers (Web and Node.js)
  6. JavaScript Tracker
  7. Cookies & Local Storage

Cookies & Local Storage

By default, the Snowplow JavaScript and Browser Tracker make use of Cookies and Local Storage. The behaviour of each of these cookies and local storage keys are described here. The base name of each cookie can be configured by following these instructions.


Cookies are only stored if stateStorageStrategy is set to cookiecookieAndLocalStorage (default) or if the deprecated tracker initialisation argument configUseCookies is set to true (default). When using cookieAndLocalStorage this will prefer cookie storage for _sp_id and _sp_ses.

Cookie NameExpiresDescription
_sp_id2 years or cookieLifetime set on tracker initialisationStores user information that is created when a user first visits a site and updated on subsequent visits. It is used to identify users and track the users activity across a domain. This cookie stores a unique identifier for each user, a unique identifier for the users current session, the number of visits a user has made to the site, the timestamp of the users first visit, the timestamp of their previous visit and the timestamp of their current visit.
_sp_ses30 minutes or sessionCookieTimeout set on tracker initialisationUsed to identify if the user is in an active session on a site or if this is a new session for a user (i.e. cookie doesn’t exist or has expired).
When using anonymousTracking: { withSessionTracking: true } (2.15.0+) this key will contain a salt value which is used to stitch page views into a session. The value is never sent to the collector.
sp1 year or collector.cookie.expiration set in collector configStores a server-side collector generated unique identifier for a user that is sent with all subsequent tracking event events. Can be used as a first party cookie is the collector is on the same domain as the site. Can be disabled by setting collector.cookie.enabled to false (See here for more information).

_sp_id is stored in the format: {domainUserId}.{createdTime}.{visitCount}.{nowTime}.{lastVisitTime}.{sessionId}

Local Storage

Local Storage will only be used if stateStorageStrategy is set to localStoragecookieAndLocalStorage (default) or if the deprecated tracker initialisation argument configUseLocaStorage is set to true (default). Both cookies listed above can be stored in local storage rather than as cookies by setting stateStorageStrategy to localStorage. Local storage can be disabled by setting stateStorageStrategy to cookie or none.

Storage KeyDescription
snowplowOutQueue_{namespace}_post2Used to store a cache of unsent events. This is used to reduce the chance of events to be lost due to page navigation and events not being set to the collector before the navigation event occurs. Where GET requests are used, this key will end in _get rather than _post2.
snowplowOutQueue_{namespace}_post2.expiresUsed to match the concept of cookie expiry within Local Storage. This ensures a consistent behaviour between cookie and local storage. Where GET requests are used, this key will end in _get rather than _post2.

Mapping Values to Tracker Protocol

The values stored in the cookies listed above are mapped into the tracker protocol when events are sent to a Snowplow Collector.

The below table shows which parameters the cookie values map to:

Request ParameterEvent ParameterCookie Value

Allowing users to Opt Out

The JavaScript tracker offers two methods that allow the users to opt out of using cookies (and local storage in the case of _sp_id and _sp_ses).

Further Information

How the JavaScript tracker utilises these cookies to store state as well as information on how to retrieve the values can be found below.


If you’d like to learn more about Snowplow Insights you can book a demo with our team, or if you’d prefer, you can try Snowplow technology for yourself quickly and easily.