# What is the distribution of 1st party vs 3rd party resources?

**URL:** <https://discuss.httparchive.org/t/what-is-the-distribution-of-1st-party-vs-3rd-party-resources/100>\
**Category:** Analysis\
**Created:** [November 8, 2013, 4:29am UTC](https://discuss.httparchive.org/t/what-is-the-distribution-of-1st-party-vs-3rd-party-resources/100 "2013-11-08T04:29:34Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![paulcalvano](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/paulcalvano/32/1601_2.png) [@paulcalvano](https://discuss.httparchive.org/u/paulcalvano)\
**Post date:** [October 19, 2017, 3:06am UTC](https://discuss.httparchive.org/t/what-is-the-distribution-of-1st-party-vs-3rd-party-resources/100/11 "2017-10-19T03:06:13Z")

</div>

I thought it would be interesting to explore this in terms of histograms. But first, let’s update the above query with Standard SQL syntax. Here’s what I believe is the equivalent query in Standard SQL:

```sql
SELECT party,
       APPROX_QUANTILES(cnt, 100)[SAFE_ORDINAL(50)] p50,
       APPROX_QUANTILES(cnt, 100)[SAFE_ORDINAL(75)] p75,
       APPROX_QUANTILES(cnt, 100)[SAFE_ORDINAL(90)] p90,
       APPROX_QUANTILES(cnt, 100)[SAFE_ORDINAL(95)] p95
FROM (
    SELECT origin,
           IF (STRPOS(req_host,REGEXP_EXTRACT(origin, r'([\w-]+)'))>0, 1, 3) AS party,
           COUNT(*) as cnt
    FROM httparchive.runs.2017_09_15_requests requests JOIN (
         SELECT pageid, NET.REG_DOMAIN(url) as origin
         FROM httparchive.runs.2017_09_15_pages
    ) pages ON pages.pageid = requests.pageid
    GROUP BY origin, party 
)
GROUP by party

```

Note that I’ve swapped:

```sql
IF (req_host CONTAINS REGEXP_EXTRACT(origin, r'([\w-]+)'), INTEGER(1), INTEGER(3)) AS party,

```

for

```sql
IF (STRPOS(req_host,REGEXP_EXTRACT(origin, r'([\w-]+)'))>0, 1, 3) AS party,

```

Next I decided to take the same classification logic, and calculate the percentage of 3rd party resources per page

```sql
SELECT percent_third_party, count(*) as total
FROM (
    SELECT pages.url, FLOOR((SUM(IF(STRPOS(NET.HOST(requests.url),REGEXP_EXTRACT(NET.HOST(pages.url), r'([\w-]+)'))>0, 0, 1)) / COUNT(*))*100) percent_third_party
    FROM httparchive.runs.2017_09_15_pages pages 
    JOIN httparchive.runs.2017_09_15_requests requests
    ON pages.pageid = requests.pageid
    GROUP BY pages.url
	)
GROUP BY percent_third_party
ORDER BY percent_third_party

```

I wound up with the following histogram, which shows that 6.4% of sites had no 3rd party content, and 38% had more than 75% third party content. The rest of the population spanned the entire range  
 ![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/465eb9c029639a5fd15cb9a74bf04baba307b514.png)

I was curious to see if there was any correlation to Alexa ranking, so I ran the same analysis for Alexa rankings \< 100K, 50K, \<10K and \<1K. The results visually appear consistent across these as you can see in the 2 graphs below:  
 ![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/e8547f3190a3a56abc5180a6642d43afb9fdea53.png)

Looking at the numbers, I can see that the percentage is skewed towards more 3rd party content for more popular sites.

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/df159973bcf09066b1714fb7a98d46f14d3f9595.png)

But what about historical trends? Let’s compare the histograms for Sept 15th for the past 5 years: (Note I trimmed the Y axis in this graph for readability). What’s interesting in tihs is that it seems like the top 25% of sites w/ 3rd party content is increasing each year except for 2015…

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/56e2318ffc400e14965181d20900c6d2063ccd46.png)

Looking at the same stats, I can see there were more sites in 2015 - which explains the skew. There were also significantly less sites in 2012-2014. So what this data is essentially telling us is:

- There’s an increase in 3rd party usage from 2016 to 2017
- There’s an increase from 2012 to 2013
- There was no signficant change from 2013 to 2015.
- There’s not much fluctaution in the top 15% from year to year

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/5cc06a0b5b82f91f0d4f7c4fd82d9079a706b0a8.png)

---

_[View the full topic](https://discuss.httparchive.org/t/what-is-the-distribution-of-1st-party-vs-3rd-party-resources/100)._
