Media Player
Package Configuration Variablesโ
This package utilizes a set of variables that are configured to recommended values for optimal performance of the models. Depending on your use case, you might want to override these values by adding to your dbt_project.yml
file.
All variables in Snowplow packages start with snowplow__
but we have removed these in the below table for brevity.
Warehouse and trackerโ
Variable Name | Description | Default |
---|---|---|
percent_progress_boundaries | The list of percent progress values. It needs to be aligned with the values being tracked by the tracker. It is worth noting that the more these percent progress boundaries are being tracked the more accurate the play time calculations become. Please note that tracking 100% is unnecessary as there is a separate ended event which the model equates to achieving 100% and it also gets included automatically to this list, in case it is not added (you can refer to the helper macro get_percentage_boundaries (source) for details). | [10, 25, 50, 75] |
Operation and logicโ
Variable Name | Description | Default |
---|---|---|
complete_play_rate | The rate to set what percentage of a media needs to be played in order to consider that complete. 0.99 (=99%) is set as a default value here but it may be increased to 1 (or decreased) depending on the use case. | 0.99 |
max_media_pv_window | The number of hours that needs to pass before new page_view level media player metrics from the snowplow_media_player_base table are safe to be processed by the model downstream in the snowplow_media_player_media_stats table. Please note that even if new events are added later on ( e.g. new percentprogress events are fired indicating potential replay) and the snowplow_media_player_base table is changed, the model will not update them in the media_stats table, therefore it is safer to set as big of a number as still convenient for analysis and reporting. | 10 |
valid_play_sec | The minimum number of seconds that a media play needs to last to consider that interaction a valid play. The default is 30 seconds (based on the YouTube standard) but it can be modified here, if needed. | 30 |
surrogate_key_treat_nulls_as_empty_strings | Passed through to dbt_utils to match legacy surrogate key behavior. | true |
Contexts, filters, and logsโ
Variable Name | Description | Default |
---|---|---|
enable_whatwg_media | Set to true if the HTML5 video element context schema is enabled. This variable is used to handle syntax depending on whether the context fields are available in the database or not. | false |
enable_whatwg_video | Set to true if the HTML5 video element context schema is enabled. This variable is used to handle syntax depending on whether the context fields are available in the database or not. | false |
enable_youtube | Set to true if the YouTube context schema is enabled. This variable is used to handle syntax depending on whether the context fields are available in the database or not. | false |
Warehouse Specificโ
- Redshift & Postgres
Redshift and Postgres use a shredded approach for the context tables, so these variables are used to identify where they are, if different from the expected schema and table name. They must be passed in a stringified source
function as the defaults below show.
Variable Name | Default |
---|---|
media_player_event_context | "{{ source('atomic', 'com_snowplowanalytics_snowplow_media_player_event_1') }}" |
media_player_context | "{{ source('atomic', 'com_snowplowanalytics_snowplow_media_player_1') }}" |
youtube_context | "{{ source('atomic', 'com_youtube_youtube_1') }}" |
html5_media_element_context | "{{ source('atomic', 'org_whatwg_media_element_1') }}" |
html5_video_element_context | "{{ source('atomic', 'org_whatwg_video_element_1') }}" |
Output Schemasโ
By default all scratch/staging tables will be created in the <target.schema>_scratch
schema, the derived tables, will be created in <target.schema>_derived
and all manifest tables in <target.schema>_snowplow_manifest
. Some of these schemas are only used by specific packages, ensure you add the correct configurations for each packages you are using. To change, please add the following to your dbt_project.yml
file:
If you want to use just your connection schema with no suffixes, set the +schema:
values to null
models:
snowplow_media_player:
web:
+schema: my_derived_schema
scratch:
+schema: my_manifest_schema
custom:
+schema: my_manifest_schema
Config Generatorโ
You can use the below inputs to generate the code that you need to place into your dbt_project.yml
file to configure the package as you require. Any values not specified will use their default values from the package.
Project Variables:
vars:
snowplow_media_player: null