SP Cookie value

Hello,

I’ve been kicking around the idea of reading in the Snowplow cookie and using it for targeting/customisation purposes based on the data we already have received in previous sessions.

So breaking the following Cookie value apart:

b88ce7da-3875-403d-9104-d5d4053db74d.1649843437.64.1655134821.1655131146.69d59dc5-157b-4cab-a1f1-d07752bba28c

I’ve come up with the following:

b88ce7da-3875-403d-9104-d5d4053db74d. The Domain UserId 

1649843437. - Wednesday, 13 April 2022 09:50:37 (cookie create date)

64. Session index

1655134731. - Monday, 13 June 2022 15:38:51 (last event or current session start?)

1655131146. - Monday, 13 June 2022 14:39:06 (previous session start i.e index 63?)

69d59dc5-157b-4cab-a1f1-d07752bba28c - Domain SessionId

Are my assumptions correct? I’m particularly interested in the final two timestamps and probably only require clarification on this.

Thanks
Kyle

This is pretty much spot on. The order in the cookie will be:

  • domain user_id
  • cookie creation timestamp (epoch)
  • domain session index (visit count)
  • current visit timestamp (now)
  • last visit timestamp (empty if no previous session)
  • session id

Rather than parsing the cookie you may be able to grab some of these values directly (assuming the tracker is on the page) by using a similar method to the client_session context.

2 Likes

Hey @kfitzpatrick

The format is described here: Cookies & Local Storage - Snowplow Docs

A more detailed explanation of the cookie is here: How the tracker stores state - Snowplow Docs

And a little snippet on how to parse it: Getting the domain user information from the Snowplow Cookie - Snowplow Docs

2 Likes

@mike & @PaulBoocock

Thanks guys exactly what I need, appreciate the responses.

1 Like