Setting up a single collector for multiple domains


#1

Hi all,
I’m attempting to configure one instance of the scala stream collector 0.13.0 to receive data for multiple domains.

I have the javascript tracker setup for each domain, and the id and ses cookies are landing in the browser.

However, what do I do in the collector’s config.hocon? I’ve tried these settings, and the collector’s cookie isn’t landing in the browser. I’d like apps on subdomains to be able to access the cookie as well, so commenting out the domain setting isn’t preferred.

  crossDomain {
    enabled = true
    # Domain that is granted access, *.acme.com will match http://acme.com and http://sub.acme.com
    domain = "*"
    # Whether to only grant access to HTTPS or both HTTPS and HTTP sources
    secure = true
  }

  cookie {
    enabled = true
    expiration = 90d
    # Network cookie name
    name = _12345_
    # The domain is optional and will make the cookie accessible to other
    # applications on the domain. Comment out this line to tie cookies to
    # the collector's full domain
    domain = "*"
  }

Thanks!

Edit: I just found an additional error that is probably affecting this, but I’d still like to hear from anyone regarding how to configure the above for multiple domains.


#3

@rob, to allow for tracking cookies across subdomains you need to refer to Javascript Tracker rather than collector.

Generally, you can track 1st party cookie set on the browser (domain_userid, domain_sessionid) as well as 3rd party cookie set on the collector (network_userid).

The domain_userid is a UUID which is generated by the Javascript tracker. Be aware if a user deletes their cookies, or the cookie expires, a new domain_userid will be generated (which will make them look like a new user). Also, if the user visits from another browser or computer, it will look like this is a totally different user.

The network_userid is set as a third party cookie ID. It is typically used when site visitors need to be uniquely identified across multiple different domains (e.g. on a content or ad network). In a nutshell, the Stream Collector receives events from the Snowplow JavaScript tracker, sets/updates a third-party user tracking cookie, and returns the pixel to the client. The ID in this third-party user tracking cookie is stored in the network_userid field in Snowplow events. However, many browsers block 3rd party cookies by default (e.g. Safari & Firefox).

To track users across subdomains set cookieDomain property to your domain as in

cookieDomain: .your_domain.com

Alternatively, if the optional discoverRootDomain field of the argmap is set to true, the Tracker automatically discovers and sets the cookie domain value to the root domain.

When tracking across domains


#4

Thanks @ihor, very helpful info.

I have the first party cookies working as I’d like. However, I’m still not clear about how to set the third party cookies to work for multiple primary domains. For example, I’d like the third party cookie to be set for .domain1.com, .domain2.com, and .domain3.com instead of all of the third party cookies for those three domains getting a cookie that is from domain1.com.

If I comment out the cookie.domain config in config.hocon, I can partially achieve this, but the cookies are set for collector.domain1.com, collector.domain2.com, and collector.domain3.com. I’d like to remove the collector part so that subdomains have access to those cookies (therefore the cookies are set to .domain1.com, etc).

How can I achieve this?

I’ve tried these cookie.domain configs in config.hocon unsuccessfully:

domain = "*"
domain = ".*"
domain = "*.*"
domain = "*.*.*"\

Or am I misunderstanding the purpose of a third party cookie? Should the third party cookie actually have the same domain configuration across multiple domains?


#5

The network_userid is set on the collector domain and as such is read on the collector. Having the same collector domain is what allows the network user ID to be the same across domains.

Consider the following example to see how domain_userid and network_userid differ. Assuming a single user/browser:

  • Events from domain1.com are sent to collector.com with domain_userid = A and at the collector the 3rd party cookie is read, enriching the event with network_userid = X
  • Events from domain2.com are sent to collector.com with domain_userid = B and at the collector the 3rd party cookie is read, enriching the event with network_userid = X

If we were to set up a different collector with a different CNAME, network user ID would be different because the pipeline would not be able to access the cookie that is already stored against the first collector domain.

The cookie cannot be read on the website though unless the website domain is the same as the cookie domain of the 3rd party cookie.