@@ -8,11 +8,12 @@ publish('tech_report_categories', {
88WITH pages AS (
99 SELECT DISTINCT
1010 client,
11- root_page ,
12- technologies
13- FROM ${ ctx . ref ( 'crawl' , 'pages' ) }
11+ technologies ,
12+ root_page
13+ FROM ${ ctx . ref ( 'crawl' , 'pages' ) } AS pages
1414 WHERE
1515 date = '${ pastMonth } '
16+ AND technologies IS NOT NULL
1617 ${ constants . devRankFilter }
1718),
1819
@@ -23,6 +24,26 @@ category_descriptions AS (
2324 FROM ${ ctx . ref ( 'wappalyzer' , 'categories' ) }
2425),
2526
27+ crux AS (
28+ SELECT
29+ IF(device = 'desktop', 'desktop', 'mobile') AS client,
30+ CONCAT(origin, '/') AS root_page
31+ FROM ${ ctx . ref ( 'chrome-ux-report' , 'materialized' , 'device_summary' ) }
32+ WHERE
33+ date = '${ pastMonth } '
34+ AND device IN ('desktop', 'phone')
35+ ),
36+
37+ merged_pages AS (
38+ SELECT DISTINCT
39+ client,
40+ technologies,
41+ root_page
42+ FROM pages
43+ INNER JOIN crux
44+ USING (client, root_page)
45+ ),
46+
2647category_stats AS (
2748 SELECT
2849 category,
@@ -35,8 +56,8 @@ category_stats AS (
3556 client,
3657 category,
3758 COUNT(DISTINCT root_page) AS origins
38- FROM pages
39- INNER JOIN pages .technologies AS tech
59+ FROM merged_pages
60+ INNER JOIN merged_pages .technologies AS tech
4061 INNER JOIN tech.categories AS category
4162 WHERE
4263 category IS NOT NULL
@@ -87,7 +108,7 @@ FROM (
87108 SELECT
88109 client,
89110 COUNT(DISTINCT root_page) AS origins
90- FROM pages
111+ FROM merged_pages
91112 GROUP BY client
92113)
93114` ) . postOps ( ctx => `
0 commit comments