Skip to main content

Cookie extractor enrichment

This enrichment extracts name-value pairs from cookies set on the collector domain, attaching them to the event as derived contexts.

A powerful attribute of using a custom collector domain is the ability to capture values in first-party cookies set by other services such as ad servers or content management software (CMS). By capturing these cookie fields and attaching them to the event, you can use the data to better identify users of your website.

Examples

The following table provides examples of how the cookie and collector domains interact, indicating whether or not the cookies can be accessed with this enrichment.

Collector DomainCookie DomainCookies Extracted
c.snowplow.ioacme.com
t.acme.comacme.com
sp.track.acme.comacme.com

Configuration

In the configuration we specify the list of cookie keys for which we want to extract the value and attach it to the event.

The example configuration is capturing Scala Stream Collector’s own “sp” cookie value but in practice we would probably want to extract other more valuable cookies available on the company domain.

Testing with Micro

Unsure if your enrichment configuration is correct or works as expected? You can easily test it using Snowplow Micro on your machine. Follow the Micro usage guide to set up Micro and configure it to use your enrichment.

You will likely also need to configure Micro to work with first-party cookies.

Input

This enrichment uses the Cookie HTTP header.

Output

For each key listed in the configuration, a context with this schema is added to the enriched event. Each context contains only one key/value pair.