/
core_web_vital_results_query.sql
38 lines (31 loc) · 1.51 KB
/
core_web_vital_results_query.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{#
Copyright (c) 2020-present Snowplow Analytics Ltd. All rights reserved.
This program is licensed to you under the Snowplow Community License Version 1.0,
and you may not use this file except in compliance with the Snowplow Community License Version 1.0.
You may obtain a copy of the Snowplow Community License Version 1.0 at https://docs.snowplow.io/community-license-1.0
#}
{% macro core_web_vital_results_query(suffix) %}
{{ return(adapter.dispatch('core_web_vital_results_query', 'snowplow_web')(suffix)) }}
{%- endmacro -%}
{% macro default__core_web_vital_results_query(suffix) %}
case when lcp{{suffix}} is null then 'not measurable'
when lcp{{suffix}} < 2.5 then 'good'
when lcp{{suffix}} < 4 then 'needs improvement'
else 'poor' end as lcp_result,
case when fid{{suffix}} is null then 'not measurable'
when fid{{suffix}} < 100 then 'good'
when fid{{suffix}} < 300 then 'needs improvement'
else 'poor' end as fid_result,
case when cls{{suffix}} is null then 'not measurable'
when cls{{suffix}} < 0.1 then 'good'
when cls{{suffix}} < 0.25 then 'needs improvement'
else 'poor' end as cls_result,
case when ttfb{{suffix}} is null then 'not measurable'
when ttfb{{suffix}} < 800 then 'good'
when ttfb{{suffix}} < 1800 then 'needs improvement'
else 'poor' end as ttfb_result,
case when inp{{suffix}} is null then 'not measurable'
when inp{{suffix}} < 200 then 'good'
when inp{{suffix}} < 500 then 'needs improvement'
else 'poor' end as inp_result
{% endmacro %}