diff --git a/docs/markdown/snowplow_unified_common_cols.md b/docs/markdown/snowplow_unified_common_cols.md index b7fcc8fa..680e212b 100644 --- a/docs/markdown/snowplow_unified_common_cols.md +++ b/docs/markdown/snowplow_unified_common_cols.md @@ -1217,3 +1217,61 @@ Referrer URL, source of this deep-link. {% docs col_event_index_in_session %} A session index of the event. {% enddocs %} + +{% docs col_foreground_sec %} +Time in seconds spent on the current screen while the app was in foreground. +{% enddocs %} + +{% docs col_background_sec %} +Time in seconds spent on the current screen while the app was in background +{% enddocs %} + +{% docs col_last_item_index %} +Index of the last viewed item in the list on the screen +{% enddocs %} + +{% docs col_items_count %} +Total number of items in the list on the screen +{% enddocs %} + +{% docs col_min_x_offset %} +Minimum horizontal scroll offset on the scroll view in pixels +{% enddocs %} + +{% docs col_max_x_offset %} +Maximum horizontal scroll offset on the scroll view in pixels +{% enddocs %} + +{% docs col_min_y_offset %} +Minimum vertical scroll offset on the scroll view in pixels +{% enddocs %} + +{% docs col_max_y_offset %} +Maximum vertical scroll offset on the scroll view in pixels +{% enddocs %} + +{% docs col_content_width %} +Width of the scroll view in pixels +{% enddocs %} + +{% docs col_content_height %} +Height of the scroll view in pixels +{% enddocs %} + +{% docs col_last_list_item_index %} +Index of the last viewed item in the list on the screen + +This is calculated only for mobile apps based on the `screen_summary` context. +{% enddocs %} + +{% docs col_list_items_count %} +Total number of items in the list on the screen + +This is calculated only for mobile apps based on the `screen_summary` context. +{% enddocs %} + +{% docs col_list_items_percentage_scrolled %} +Total number of items in the list on the screen + +This is calculated only for mobile apps based on the `screen_summary` context. +{% enddocs %} diff --git a/models/base/scratch/base_scratch.yml b/models/base/scratch/base_scratch.yml index bf89f627..fa0be6ae 100644 --- a/models/base/scratch/base_scratch.yml +++ b/models/base/scratch/base_scratch.yml @@ -440,6 +440,16 @@ models: - name: app_error__stack_trace - name: app_error__thread_id - name: app_error__thread_name + - name: screen_summary__foreground_sec + - name: screen_summary__background_sec + - name: screen_summary__last_item_index + - name: screen_summary__items_count + - name: screen_summary__min_x_offset + - name: screen_summary__min_y_offset + - name: screen_summary__max_x_offset + - name: screen_summary__max_y_offset + - name: screen_summary__content_width + - name: screen_summary__content_height - name: snowplow_unified_events_this_run description: '{{ doc("table_events_this_run") }}' columns: @@ -709,6 +719,16 @@ models: - name: app_error__thread_name - name: app_error___tstamp - name: app_error___id + - name: screen_summary__foreground_sec + - name: screen_summary__background_sec + - name: screen_summary__last_item_index + - name: screen_summary__items_count + - name: screen_summary__min_x_offset + - name: screen_summary__min_y_offset + - name: screen_summary__max_x_offset + - name: screen_summary__max_y_offset + - name: screen_summary__content_width + - name: screen_summary__content_height - name: deep_link__url - name: deep_link__referrer - name: deep_link___tstamp @@ -756,4 +776,3 @@ models: - name: device_identifier - name: platform_name - name: device_category - # TODO: add screen summary fields diff --git a/models/base/src_base.yml b/models/base/src_base.yml index 94c708ea..c009be9f 100644 --- a/models/base/src_base.yml +++ b/models/base/src_base.yml @@ -574,5 +574,30 @@ sources: description: '{{ doc("col_url") }}' - name: referrer description: '{{ doc("col_referrer") }}' - # TODO: add screen summary table - + - name: contexts_com_snowplowanalytics_mobile_screen_summary_1 + description: '{{ doc("table_deep_link_context") }}' + columns: + - name: root_id + description: '{{ doc("col_root_id") }}' + - name: root_tstamp + description: '{{ doc("col_root_tstamp") }}' + - name: foreground_sec + description: '{{ doc("col_foreground_sec") }}' + - name: background_sec + description: '{{ doc("col_background_sec") }}' + - name: last_item_index + description: '{{ doc("col_last_item_index") }}' + - name: items_count + description: '{{ doc("col_items_count") }}' + - name: min_x_offset + description: '{{ doc("col_min_x_offset") }}' + - name: max_x_offset + description: '{{ doc("col_max_x_offset") }}' + - name: min_y_offset + description: '{{ doc("col_min_y_offset") }}' + - name: max_y_offset + description: '{{ doc("col_max_y_offset") }}' + - name: content_width + description: '{{ doc("col_content_width") }}' + - name: content_height + description: '{{ doc("col_content_height") }}' diff --git a/models/views/scratch/snowplow_unified_pv_engaged_time.sql b/models/views/scratch/snowplow_unified_pv_engaged_time.sql index 180f5ca2..2a84e98f 100644 --- a/models/views/scratch/snowplow_unified_pv_engaged_time.sql +++ b/models/views/scratch/snowplow_unified_pv_engaged_time.sql @@ -24,7 +24,6 @@ select ev.view_id, ev.session_identifier, max(ev.derived_tstamp) as end_tstamp, - {# todo: coalesce from the screen_summary entity, foreground_sec property #} ({{ heartbeat_length }} * ({{ n_unique_pings }} - 1)) + {{ min_visit_length }} as engaged_time_in_s from {{ ref('snowplow_unified_events_this_run') }} as ev diff --git a/models/views/views.yml b/models/views/views.yml index a658a9bb..9a161c2b 100644 --- a/models/views/views.yml +++ b/models/views/views.yml @@ -80,7 +80,12 @@ models: description: Percentage of page scrolled horizontally - name: vertical_percentage_scrolled description: Percentage of page scrolled vertically - # TODO: add list metrics + - name: last_list_item_index + description: '{{ doc("col_last_list_item_index") }}' + - name: list_items_count + description: '{{ doc("col_list_items_count") }}' + - name: list_items_percentage_scrolled + description: '{{ doc("col_list_items_percentage_scrolled") }}' - name: doc_width description: '{{ doc("col_doc_width") }}' - name: doc_height