Measuring what fraction of your visitors have third party cookies blocked


#1

If you want to use the network_userid (i.e. third party cookie ID value) to perform analysis, it is sensible to measure what fraction of your userbase has third party cookies enabled / disabled.

This can be done using the following query:

with tpcids_and_pvs_by_fpcids as (
  select 
    domain_userid,
    count(distinct(network_userid)) as number_of_3rd_party_cookie_ids,
    count() as page_views
  from atomic.events
  where event = 'page_view'
  group by 1
)
select
  case when number_of_3rd_party_cookie_ids = page_views then 'third party cookies blocked' else 'third party cookies enabled' end,
  count()
from tpcids_and_pvs_by_fpcids
where page_views > 1
group by 1;

The query works by:

  1. Identifying users (as identified by first party cookie IDs i.e. the domain_userid that have viewed more than one page
  2. Counting the number of network_userid values that have been assigned to users who have visited more than one page
  3. Comparing the number of distinct network_userid values to pages viewed. For a user who has 3rd party cookies blocked, each time they visit a new page a new value of network_userid will be set. So if a user has visited three pages, and has three distinct values for their network_userid, we can be very confident that he/she has third party cookies blocked.

#2

We use a custom collector that redirects through to Cloudfront but if the beacon doesn’t contain the third-party cookie, we set the cookie and redirect back to itself with a slightly changed URL (so we don’t end up with redirect loops), and then redirects off to Cloudfront for collection.

You can see it in action with:
curl -v -L 'http://d.aww.com.au/i?e=pv&page=Recipes%2C%20Celebrity%20News%2C%20Diet%2C%20Living%2C%20Family%2C%20Food%20Recipes%20%3A%20Australian%20Women%27s%20Weekly%20%7C%20Australian%20Women%27s%20Weekly&cx=eyJwYWdlIjp7ImNhdGVnb3J5Ijp7Imdyb3VwaW5nQ2F0ZWdvcnkiOiIiLCJwcmltYXJ5Q2F0ZWdvcnkiOiIiLCJwYWdlVHlwZSI6IkhvbWVwYWdlIiwibWFzdGhlYWQiOiJBV1cifSwiYnJlYWRDcnVtYnMiOlsiaG9tZSJdLCJkYXRlQ3JlYXRlZCI6IjIwMTQtMDktMjVUMDk6MjU6NDIiLCJwYWdlSWQiOiJBV1ctMTE0MyIsIm5vZGVUeXBlQWxpYXMiOiJIb21lcGFnZSIsImNvbnRlbnRUYWdzIjpbXSwiYXV0aG9yIjoibnVsbCIsImNhbm9uaWNhbFVybCI6Imh0dHA6Ly93d3cuYXd3LmNvbS5hdS8ifX0&dtm=1462333168114&tid=933696&vp=375x667&ds=390x6098&vid=112&duid=987d5230816b7c91&p=web&tv=js-1.0.3&fp=3330066770&aid=aww.com.au&lang=en-US&cs=UTF-8&tz=Australia%2FSydney&res=375x667&cd=24&cookie=1&url=http%3A%2F%2Fwww.aww.com.au%2F' >/dev/null


#3

@shermozle This feature has been suggested by me as a RFC: Scala Stream Collector: add support for cookie bounce

And it has been implemented and submitted as a pull request: https://github.com/snowplow/snowplow/pull/2755

So it might become available to all snowplow users.