feat: move mobile engagement logic into mobile kpi support metrics generator (#5661)
* feat: move mobile_engagement SQL logic into mobile_kpi_support_metrics generator * feat: remove mobile_engagement queries from telemetry and telemetry_erived * feat: apply formatting to engagement_clients view and add checks template * feat: add engagement view template and add engagement templates to the generation logic * bug: fix engagement query errors * feat: sneak in removing of retention views inside telemetry (mobile kpi generator will overwrite these anyways) * feat: remove bqetl_mobile_engagement_model DAG from DAG list as no longer needed. * feat: fix an engagement_v1 query template and removed unecessary comment from the metadata template * fix: update engagement templates to ensure valid query is rendered
This commit is contained in:
Родитель
a12f6dc726
Коммит
5b23aa1349
17
dags.yaml
17
dags.yaml
|
@ -1657,20 +1657,3 @@ bqetl_ios_campaign_reporting:
|
|||
retry_delay: 30m
|
||||
tags:
|
||||
- impact/tier_2
|
||||
|
||||
bqetl_mobile_engagement_model:
|
||||
schedule_interval: 0 12 * * *
|
||||
description: Loads the mobile engagement model tables
|
||||
default_args:
|
||||
depends_on_past: false
|
||||
owner: kwindau@mozilla.com
|
||||
email:
|
||||
- kwindau@mozilla.com
|
||||
- telemetry-alerts@mozilla.com
|
||||
email_on_failure: true
|
||||
email_on_retry: false
|
||||
start_date: "2024-05-16"
|
||||
retries: 2
|
||||
retry_delay: 30m
|
||||
tags:
|
||||
- impact/tier_2
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.telemetry.mobile_engagement_clients`
|
||||
AS
|
||||
SELECT
|
||||
a.*,
|
||||
CASE
|
||||
WHEN first_seen_date = submission_date
|
||||
THEN 'new_profile'
|
||||
WHEN DATE_DIFF(submission_date, first_seen_date, DAY)
|
||||
BETWEEN 1
|
||||
AND 27
|
||||
THEN 'repeat_user'
|
||||
WHEN DATE_DIFF(submission_date, first_seen_date, DAY) >= 28
|
||||
THEN 'existing_user'
|
||||
ELSE 'Unknown'
|
||||
END AS lifecycle_stage
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.telemetry_derived.mobile_engagement_clients_v1` a
|
|
@ -1,60 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.telemetry.mobile_retention`
|
||||
AS
|
||||
SELECT
|
||||
metric_date,
|
||||
first_seen_date,
|
||||
app_name,
|
||||
normalized_channel,
|
||||
app_version,
|
||||
locale,
|
||||
country,
|
||||
adjust_ad_group,
|
||||
adjust_campaign,
|
||||
adjust_creative,
|
||||
adjust_network,
|
||||
play_store_attribution_campaign,
|
||||
play_store_attribution_medium,
|
||||
play_store_attribution_source,
|
||||
meta_attribution_app,
|
||||
install_source,
|
||||
FALSE AS is_suspicious_device_client,
|
||||
lifecycle_stage,
|
||||
ping_sent_metric_date,
|
||||
ping_sent_week_4,
|
||||
active_metric_date,
|
||||
retained_week_4,
|
||||
new_profiles_metric_date,
|
||||
repeat_profiles,
|
||||
retained_week_4_new_profiles,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.fenix.retention`
|
||||
UNION ALL
|
||||
SELECT
|
||||
metric_date,
|
||||
first_seen_date,
|
||||
app_name,
|
||||
normalized_channel,
|
||||
app_version,
|
||||
locale,
|
||||
country,
|
||||
adjust_ad_group,
|
||||
adjust_campaign,
|
||||
adjust_creative,
|
||||
adjust_network,
|
||||
NULL AS play_store_attribution_campaign,
|
||||
NULL AS play_store_attribution_medium,
|
||||
NULL AS play_store_attribution_source,
|
||||
NULL AS meta_attribution_app,
|
||||
NULL AS install_source,
|
||||
is_suspicious_device_client,
|
||||
lifecycle_stage,
|
||||
ping_sent_metric_date,
|
||||
ping_sent_week_4,
|
||||
active_metric_date,
|
||||
retained_week_4,
|
||||
new_profiles_metric_date,
|
||||
repeat_profiles,
|
||||
retained_week_4_new_profiles,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.firefox_ios.retention`
|
|
@ -1,62 +0,0 @@
|
|||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.telemetry.mobile_retention_clients`
|
||||
AS
|
||||
SELECT
|
||||
metric_date,
|
||||
submission_date,
|
||||
first_seen_date,
|
||||
app_name,
|
||||
normalized_channel,
|
||||
app_version,
|
||||
locale,
|
||||
country,
|
||||
adjust_ad_group,
|
||||
adjust_campaign,
|
||||
adjust_creative,
|
||||
adjust_network,
|
||||
play_store_attribution_campaign,
|
||||
play_store_attribution_medium,
|
||||
play_store_attribution_source,
|
||||
meta_attribution_app,
|
||||
install_source,
|
||||
FALSE AS is_suspicious_device_client,
|
||||
lifecycle_stage,
|
||||
ping_sent_metric_date,
|
||||
ping_sent_week_4,
|
||||
active_metric_date,
|
||||
retained_week_4,
|
||||
new_profile_metric_date,
|
||||
repeat_profile,
|
||||
retained_week_4_new_profile,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.fenix.retention_clients`
|
||||
UNION ALL
|
||||
SELECT
|
||||
metric_date,
|
||||
submission_date,
|
||||
first_seen_date,
|
||||
app_name,
|
||||
normalized_channel,
|
||||
app_version,
|
||||
locale,
|
||||
country,
|
||||
adjust_ad_group,
|
||||
adjust_campaign,
|
||||
adjust_creative,
|
||||
adjust_network,
|
||||
NULL AS play_store_attribution_campaign,
|
||||
NULL AS play_store_attribution_medium,
|
||||
NULL AS play_store_attribution_source,
|
||||
NULL AS meta_attribution_app,
|
||||
NULL AS install_source,
|
||||
is_suspicious_device_client,
|
||||
lifecycle_stage,
|
||||
ping_sent_metric_date,
|
||||
ping_sent_week_4,
|
||||
active_metric_date,
|
||||
retained_week_4,
|
||||
new_profile_metric_date,
|
||||
repeat_profile,
|
||||
retained_week_4_new_profile,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.firefox_ios.retention_clients`
|
|
@ -1,24 +0,0 @@
|
|||
friendly_name: Mobile Engagement Clients
|
||||
description: |-
|
||||
Engagement attributes at a client level for mobile Firefox users
|
||||
owners:
|
||||
- kwindau@mozilla.com
|
||||
labels:
|
||||
incremental: true
|
||||
owner1: kwindau@mozilla.com
|
||||
scheduling:
|
||||
dag_name: bqetl_mobile_engagement_model
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: true
|
||||
expiration_days: null
|
||||
range_partitioning: null
|
||||
clustering:
|
||||
fields:
|
||||
- sample_id
|
||||
- country
|
||||
- app_name
|
||||
- app_version
|
||||
references: {}
|
|
@ -1,156 +0,0 @@
|
|||
WITH mobile_clients_last_seen AS (
|
||||
--Fenix
|
||||
SELECT
|
||||
'Fenix' AS source,
|
||||
sample_id,
|
||||
submission_date,
|
||||
client_id,
|
||||
first_seen_date,
|
||||
normalized_channel,
|
||||
locale,
|
||||
country,
|
||||
isp,
|
||||
app_name,
|
||||
app_display_version AS app_version,
|
||||
is_dau,
|
||||
is_wau,
|
||||
is_mau,
|
||||
is_mobile
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.fenix.active_users`
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
UNION ALL
|
||||
--Firefox iOS
|
||||
SELECT
|
||||
'Firefox iOS' AS source,
|
||||
sample_id,
|
||||
submission_date,
|
||||
client_id,
|
||||
first_seen_date,
|
||||
normalized_channel,
|
||||
locale,
|
||||
country,
|
||||
isp,
|
||||
app_name,
|
||||
app_display_version AS app_version,
|
||||
is_dau,
|
||||
is_wau,
|
||||
is_mau,
|
||||
is_mobile
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.firefox_ios.active_users`
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
UNION ALL
|
||||
--Focus Android
|
||||
SELECT
|
||||
'Focus Android' AS source,
|
||||
sample_id,
|
||||
submission_date,
|
||||
client_id,
|
||||
first_seen_date,
|
||||
normalized_channel,
|
||||
locale,
|
||||
country,
|
||||
isp,
|
||||
app_name,
|
||||
app_display_version AS app_version,
|
||||
is_dau,
|
||||
is_wau,
|
||||
is_mau,
|
||||
is_mobile
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.focus_android.active_users`
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
UNION ALL
|
||||
--Focus iOS
|
||||
SELECT
|
||||
'Focus iOS' AS source,
|
||||
sample_id,
|
||||
submission_date,
|
||||
client_id,
|
||||
first_seen_date,
|
||||
normalized_channel,
|
||||
locale,
|
||||
country,
|
||||
isp,
|
||||
app_name,
|
||||
app_display_version AS app_version,
|
||||
is_dau,
|
||||
is_wau,
|
||||
is_mau,
|
||||
is_mobile
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.focus_ios.active_users`
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
),
|
||||
mobile_attribution AS (
|
||||
--Fenix
|
||||
SELECT
|
||||
'Fenix' AS source,
|
||||
client_id,
|
||||
sample_id,
|
||||
adjust_network,
|
||||
adjust_campaign,
|
||||
adjust_ad_group,
|
||||
adjust_creative,
|
||||
play_store_attribution_campaign,
|
||||
play_store_attribution_source,
|
||||
play_store_attribution_medium,
|
||||
meta_attribution_app,
|
||||
install_source,
|
||||
NULL AS is_suspicious_device_client
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.fenix_derived.firefox_android_clients_v1`
|
||||
UNION ALL
|
||||
--Firefox iOS
|
||||
SELECT
|
||||
'Firefox iOS' AS source,
|
||||
client_id,
|
||||
sample_id,
|
||||
adjust_network,
|
||||
adjust_campaign,
|
||||
adjust_ad_group,
|
||||
adjust_creative,
|
||||
NULL AS play_store_attribution_campaign,
|
||||
NULL AS play_store_attribution_source,
|
||||
NULL AS play_store_attribution_medium,
|
||||
NULL AS meta_attribution_app,
|
||||
NULL AS install_source,
|
||||
is_suspicious_device_client
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.firefox_ios.firefox_ios_clients`
|
||||
)
|
||||
SELECT
|
||||
cls.submission_date,
|
||||
cls.client_id,
|
||||
cls.sample_id,
|
||||
cls.first_seen_date,
|
||||
cls.normalized_channel,
|
||||
cls.locale,
|
||||
cls.country,
|
||||
cls.isp,
|
||||
cls.app_name,
|
||||
cls.app_version,
|
||||
cls.is_dau,
|
||||
cls.is_wau,
|
||||
cls.is_mau,
|
||||
cls.is_mobile,
|
||||
attr.adjust_network,
|
||||
attr.adjust_campaign,
|
||||
attr.adjust_ad_group,
|
||||
attr.adjust_creative,
|
||||
attr.play_store_attribution_campaign,
|
||||
attr.play_store_attribution_source,
|
||||
attr.play_store_attribution_medium,
|
||||
attr.meta_attribution_app,
|
||||
attr.install_source,
|
||||
attr.is_suspicious_device_client
|
||||
FROM
|
||||
mobile_clients_last_seen cls
|
||||
LEFT JOIN
|
||||
mobile_attribution attr
|
||||
USING (client_id, source)
|
|
@ -1,97 +0,0 @@
|
|||
fields:
|
||||
- mode: NULLABLE
|
||||
name: submission_date
|
||||
type: DATE
|
||||
description: Submission Date
|
||||
- mode: NULLABLE
|
||||
name: client_id
|
||||
type: STRING
|
||||
description: Client ID
|
||||
- mode: NULLABLE
|
||||
name: sample_id
|
||||
type: INT64
|
||||
description: Sample ID
|
||||
- mode: NULLABLE
|
||||
name: first_seen_date
|
||||
type: DATE
|
||||
description: First Seen Date
|
||||
- mode: NULLABLE
|
||||
name: normalized_channel
|
||||
type: STRING
|
||||
description: Normalized Channel
|
||||
- mode: NULLABLE
|
||||
name: locale
|
||||
type: STRING
|
||||
description: Locale
|
||||
- mode: NULLABLE
|
||||
name: country
|
||||
type: STRING
|
||||
description: Country
|
||||
- mode: NULLABLE
|
||||
name: isp
|
||||
type: STRING
|
||||
description: Internet Service Provider
|
||||
- mode: NULLABLE
|
||||
name: app_name
|
||||
type: STRING
|
||||
description: App Name
|
||||
- mode: NULLABLE
|
||||
name: app_version
|
||||
type: STRING
|
||||
description: App Version (also known as app display version)
|
||||
- mode: NULLABLE
|
||||
name: is_dau
|
||||
type: BOOLEAN
|
||||
description: DAU - Daily Active User
|
||||
- mode: NULLABLE
|
||||
name: is_wau
|
||||
type: BOOLEAN
|
||||
description: WAU - Weekly Active User
|
||||
- mode: NULLABLE
|
||||
name: is_mau
|
||||
type: BOOLEAN
|
||||
description: MAU - Monthly Active User
|
||||
- mode: NULLABLE
|
||||
name: is_mobile
|
||||
type: BOOLEAN
|
||||
description: Is Mobile
|
||||
- mode: NULLABLE
|
||||
name: adjust_network
|
||||
type: STRING
|
||||
description: Adjust Network
|
||||
- mode: NULLABLE
|
||||
name: adjust_campaign
|
||||
type: STRING
|
||||
description: Adjust Campaign
|
||||
- mode: NULLABLE
|
||||
name: adjust_ad_group
|
||||
type: STRING
|
||||
description: Adjust Ad Group
|
||||
- mode: NULLABLE
|
||||
name: adjust_creative
|
||||
type: STRING
|
||||
description: Adjust Creative
|
||||
- mode: NULLABLE
|
||||
name: play_store_attribution_campaign
|
||||
type: STRING
|
||||
description: Play Store Attribution Campaign
|
||||
- mode: NULLABLE
|
||||
name: play_store_attribution_source
|
||||
type: STRING
|
||||
description: Play Store Attribution Source
|
||||
- mode: NULLABLE
|
||||
name: play_store_attribution_medium
|
||||
type: STRING
|
||||
description: Play Store Attribution Medium
|
||||
- mode: NULLABLE
|
||||
name: meta_attribution_app
|
||||
type: STRING
|
||||
description: Meta Attribution App
|
||||
- mode: NULLABLE
|
||||
name: install_source
|
||||
type: STRING
|
||||
description: Install Source
|
||||
- mode: NULLABLE
|
||||
name: is_suspicious_device_client
|
||||
type: BOOLEAN
|
||||
description: Is Suspicious Device Client
|
|
@ -1,23 +0,0 @@
|
|||
friendly_name: Mobile Engagement
|
||||
description: |-
|
||||
Aggregated summary data about mobile Firefox engagement
|
||||
owners:
|
||||
- kwindau@mozilla.com
|
||||
labels:
|
||||
incremental: true
|
||||
owner1: kwindau@mozilla.com
|
||||
scheduling:
|
||||
dag_name: bqetl_mobile_engagement_model
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: true
|
||||
expiration_days: null
|
||||
range_partitioning: null
|
||||
clustering:
|
||||
fields:
|
||||
- country
|
||||
- app_name
|
||||
- app_version
|
||||
references: {}
|
|
@ -1,85 +0,0 @@
|
|||
fields:
|
||||
- mode: NULLABLE
|
||||
name: submission_date
|
||||
type: DATE
|
||||
description: Submission Date
|
||||
- mode: NULLABLE
|
||||
name: first_seen_date
|
||||
type: DATE
|
||||
description: First Seen Date
|
||||
- mode: NULLABLE
|
||||
name: locale
|
||||
type: STRING
|
||||
description: Locale
|
||||
- mode: NULLABLE
|
||||
name: normalized_channel
|
||||
type: STRING
|
||||
description: Normalized Channel
|
||||
- mode: NULLABLE
|
||||
name: country
|
||||
type: STRING
|
||||
description: Country
|
||||
- mode: NULLABLE
|
||||
name: app_name
|
||||
type: STRING
|
||||
description: App Name
|
||||
- mode: NULLABLE
|
||||
name: app_version
|
||||
type: STRING
|
||||
description: App Version (also known as app display version)
|
||||
- mode: NULLABLE
|
||||
name: adjust_network
|
||||
type: STRING
|
||||
description: Adjust Network
|
||||
- mode: NULLABLE
|
||||
name: adjust_campaign
|
||||
type: STRING
|
||||
description: Adjust Campaign
|
||||
- mode: NULLABLE
|
||||
name: adjust_ad_group
|
||||
type: STRING
|
||||
description: Adjust Ad Group
|
||||
- mode: NULLABLE
|
||||
name: adjust_creative
|
||||
type: STRING
|
||||
description: Adjust Creative
|
||||
- mode: NULLABLE
|
||||
name: play_store_attribution_campaign
|
||||
type: STRING
|
||||
description: Play Store Attribution Campaign
|
||||
- mode: NULLABLE
|
||||
name: play_store_attribution_source
|
||||
type: STRING
|
||||
description: Play Store Attribution Source
|
||||
- mode: NULLABLE
|
||||
name: play_store_attribution_medium
|
||||
type: STRING
|
||||
description: Play Store Attribution Medium
|
||||
- mode: NULLABLE
|
||||
name: meta_attribution_app
|
||||
type: STRING
|
||||
description: Meta Attribution App
|
||||
- mode: NULLABLE
|
||||
name: install_source
|
||||
type: STRING
|
||||
description: Install Source
|
||||
- mode: NULLABLE
|
||||
name: is_suspicious_device_client
|
||||
type: BOOLEAN
|
||||
description: Flags Firefox iOS clients created recently from an older app version associated with unusual counts
|
||||
- mode: NULLABLE
|
||||
name: is_mobile
|
||||
type: BOOLEAN
|
||||
description: Is Mobile
|
||||
- mode: NULLABLE
|
||||
name: dau
|
||||
type: INT64
|
||||
description: DAU - Daily Active Users
|
||||
- mode: NULLABLE
|
||||
name: wau
|
||||
type: INT64
|
||||
description: WAU - Weekly Active Users
|
||||
- mode: NULLABLE
|
||||
name: mau
|
||||
type: INT64
|
||||
description: MAU - Monthly Active Users
|
|
@ -30,6 +30,15 @@ TEMPLATES = {
|
|||
"retention.view.sql": {
|
||||
"include_additional_attribution_fields_in_union": True,
|
||||
},
|
||||
"engagement_clients.view.sql": {
|
||||
"include_additional_attribution_fields_in_union": True,
|
||||
},
|
||||
"engagement.query.sql": {
|
||||
"include_additional_attribution_fields_in_union": True,
|
||||
},
|
||||
"engagement.view.sql": {
|
||||
"include_additional_attribution_fields_in_union": True,
|
||||
},
|
||||
}
|
||||
|
||||
ADDITIONAL_ATTRIBUTION_FIELDS_FENIX = [
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{{ header }} {% raw %}
|
||||
# warn
|
||||
{{ min_row_count(1), "WHERE submission_date = @submission_date" }} {% endraw %}
|
|
@ -0,0 +1,25 @@
|
|||
friendly_name: Profile / Client Engagement - {{ friendly_name }} (Aggregated)
|
||||
description: |-
|
||||
Profile / Client Engagement ({{ friendly_name }}) aggregated metrics
|
||||
|
||||
owners:
|
||||
- mozilla/kpi_table_reviewers
|
||||
- kik@mozilla.com
|
||||
labels:
|
||||
schedule: daily
|
||||
incremental: true
|
||||
# will be commented out in a follow up PR which will add a DAG
|
||||
# scheduling:
|
||||
# dag_name: # TODO: think about which DAG this should run in.
|
||||
# depends_on_past: false
|
||||
# task_group: {{ app_name }}
|
||||
bigquery:
|
||||
time_partitioning:
|
||||
type: day
|
||||
field: submission_date
|
||||
require_partition_filter: false
|
||||
clustering:
|
||||
fields:
|
||||
- app_name
|
||||
- country
|
||||
- first_seen_date
|
|
@ -1,45 +1,42 @@
|
|||
{{ header }}
|
||||
SELECT
|
||||
submission_date,
|
||||
first_seen_date,
|
||||
locale,
|
||||
normalized_channel,
|
||||
country,
|
||||
app_name,
|
||||
app_version,
|
||||
adjust_network,
|
||||
adjust_campaign,
|
||||
adjust_ad_group,
|
||||
adjust_creative,
|
||||
play_store_attribution_campaign,
|
||||
play_store_attribution_source,
|
||||
play_store_attribution_medium,
|
||||
meta_attribution_app,
|
||||
install_source,
|
||||
is_suspicious_device_client,
|
||||
country,
|
||||
locale,
|
||||
is_mobile,
|
||||
adjust_ad_group,
|
||||
adjust_campaign,
|
||||
adjust_creative,
|
||||
adjust_network,
|
||||
{% for field in product_specific_attribution_fields %}
|
||||
{{ field.name }},
|
||||
{% endfor %}
|
||||
COUNTIF(is_dau) AS dau,
|
||||
COUNTIF(is_wau) AS wau,
|
||||
COUNTIF(is_mau) AS mau
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.telemetry_derived.mobile_engagement_clients_v1`
|
||||
`{{ project_id }}.{{ dataset }}.engagement_clients`
|
||||
WHERE
|
||||
submission_date = @submission_date
|
||||
GROUP BY
|
||||
submission_date,
|
||||
first_seen_date,
|
||||
locale,
|
||||
normalized_channel,
|
||||
country,
|
||||
app_name,
|
||||
app_version,
|
||||
adjust_network,
|
||||
adjust_campaign,
|
||||
country,
|
||||
locale,
|
||||
is_mobile,
|
||||
adjust_ad_group,
|
||||
adjust_campaign,
|
||||
adjust_creative,
|
||||
play_store_attribution_campaign,
|
||||
play_store_attribution_source,
|
||||
play_store_attribution_medium,
|
||||
meta_attribution_app,
|
||||
install_source,
|
||||
is_suspicious_device_client,
|
||||
is_mobile
|
||||
adjust_network,
|
||||
{% for field in product_specific_attribution_fields %}
|
||||
{{ field.name }}
|
||||
{% if not loop.last %},
|
||||
{% endif %}
|
||||
{% endfor %}
|
|
@ -0,0 +1,80 @@
|
|||
fields:
|
||||
- mode: NULLABLE
|
||||
name: submission_date
|
||||
type: DATE
|
||||
description:
|
||||
|
||||
- mode: NULLABLE
|
||||
name: first_seen_date
|
||||
type: DATE
|
||||
description: When the profile has been seen for the first time.
|
||||
|
||||
- mode: NULLABLE
|
||||
name: normalized_channel
|
||||
type: STRING
|
||||
description: Release channel of the app the profile is using.
|
||||
|
||||
- name: app_name
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
description: App name the profile is using.
|
||||
|
||||
- name: app_version
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
description: Client's app version on the metric date.
|
||||
|
||||
- name: country
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
description: Client's country on the metric date.
|
||||
|
||||
- name: locale
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
description: Client's locale on the metric date.
|
||||
|
||||
- name: is_mobile
|
||||
type: BOOLEAN
|
||||
mode: NULLABLE
|
||||
description: Indicates if this specific entry is used towards calculating mobile DAU.
|
||||
|
||||
- name: adjust_ad_group
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
description: Adjust Ad Group the profile is attributed to.
|
||||
|
||||
- name: adjust_campaign
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
description: Adjust Campaign the profile is attributed to.
|
||||
|
||||
- name: adjust_creative
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
description: Adjust Creative the profile is attributed to.
|
||||
|
||||
- name: adjust_network
|
||||
type: STRING
|
||||
mode: NULLABLE
|
||||
description: Adjust Network the profile is attributed to.
|
||||
{% for field in product_specific_attribution_fields %}
|
||||
- name: {{ field.name }}
|
||||
type: {{ field.type }}
|
||||
mode: NULLABLE
|
||||
description: {{ field.description }}
|
||||
{% endfor %}
|
||||
- name: dau
|
||||
type: INTEGER
|
||||
mode: NULLABLE
|
||||
description: DAU - Daily Active Users
|
||||
|
||||
- name: wau
|
||||
type: INTEGER
|
||||
mode: NULLABLE
|
||||
description: WAU - Weekly Active Users
|
||||
|
||||
- name: mau
|
||||
type: INTEGER
|
||||
mode: NULLABLE
|
||||
description: MAU - Monthly Active Users
|
|
@ -1,8 +1,9 @@
|
|||
{{ header }}
|
||||
CREATE OR REPLACE VIEW
|
||||
`moz-fx-data-shared-prod.telemetry.mobile_engagement`
|
||||
`{{ project_id }}.{{ dataset }}.{{ name }}`
|
||||
AS
|
||||
SELECT
|
||||
a.*,
|
||||
*,
|
||||
CASE
|
||||
WHEN first_seen_date = submission_date
|
||||
THEN 'new_profile'
|
||||
|
@ -13,6 +14,6 @@ SELECT
|
|||
WHEN DATE_DIFF(submission_date, first_seen_date, DAY) >= 28
|
||||
THEN 'existing_user'
|
||||
ELSE 'Unknown'
|
||||
END AS lifecycle_stage
|
||||
END AS lifecycle_stage,
|
||||
FROM
|
||||
`moz-fx-data-shared-prod.telemetry_derived.mobile_engagement_v1` a
|
||||
`{{ project_id }}.{{ dataset }}_derived.{{ name }}_{{ version }}`
|
|
@ -0,0 +1,88 @@
|
|||
{{ header }}
|
||||
CREATE OR REPLACE VIEW
|
||||
`{{ project_id }}.{{ dataset }}.{{ name }}`
|
||||
AS
|
||||
WITH active_users AS (
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
first_seen_date,
|
||||
app_name,
|
||||
normalized_channel,
|
||||
locale,
|
||||
country,
|
||||
isp,
|
||||
app_display_version,
|
||||
is_dau,
|
||||
is_wau,
|
||||
is_mau,
|
||||
is_mobile,
|
||||
FROM
|
||||
`{{ project_id }}.{{ dataset }}.active_users`
|
||||
),
|
||||
attribution AS (
|
||||
SELECT
|
||||
client_id,
|
||||
sample_id,
|
||||
channel AS normalized_channel,
|
||||
adjust_ad_group,
|
||||
adjust_creative,
|
||||
adjust_network,
|
||||
{% if app_name == "fenix" %}
|
||||
CASE
|
||||
WHEN adjust_network IN ('Google Organic Search', 'Organic')
|
||||
THEN ''
|
||||
ELSE adjust_campaign
|
||||
END AS adjust_campaign,
|
||||
{% else %}
|
||||
adjust_campaign,
|
||||
{% endif %}
|
||||
{% for field in product_specific_attribution_fields %}
|
||||
{{ field.name if field.name != "adjust_campaign" }},
|
||||
{% endfor %}
|
||||
FROM
|
||||
{% if app_name == "fenix" %}
|
||||
`{{ project_id }}.{{ dataset }}_derived.firefox_android_clients_v1`
|
||||
{% elif app_name == "firefox_ios" %}
|
||||
`{{ project_id }}.{{ dataset }}_derived.firefox_ios_clients_v1`
|
||||
{% endif %}
|
||||
)
|
||||
SELECT
|
||||
submission_date,
|
||||
client_id,
|
||||
sample_id,
|
||||
first_seen_date,
|
||||
app_name,
|
||||
normalized_channel,
|
||||
app_display_version AS app_version,
|
||||
locale,
|
||||
country,
|
||||
isp,
|
||||
is_dau,
|
||||
is_wau,
|
||||
is_mau,
|
||||
is_mobile,
|
||||
attribution.adjust_ad_group,
|
||||
attribution.adjust_campaign,
|
||||
attribution.adjust_creative,
|
||||
attribution.adjust_network,
|
||||
{% for field in product_specific_attribution_fields %}
|
||||
attribution.{{ field.name }},
|
||||
{% endfor %}
|
||||
CASE
|
||||
WHEN active_users.submission_date = first_seen_date
|
||||
THEN 'new_profile'
|
||||
WHEN DATE_DIFF(active_users.submission_date, first_seen_date, DAY)
|
||||
BETWEEN 1
|
||||
AND 27
|
||||
THEN 'repeat_user'
|
||||
WHEN DATE_DIFF(active_users.submission_date, first_seen_date, DAY) >= 28
|
||||
THEN 'existing_user'
|
||||
ELSE 'Unknown'
|
||||
END AS lifecycle_stage,
|
||||
FROM
|
||||
active_users
|
||||
LEFT JOIN
|
||||
attribution
|
||||
USING (client_id, sample_id, normalized_channel)
|
Загрузка…
Ссылка в новой задаче