feat(project): Retrieve metric-hub segments in Experimenter (#11243)

Because

* Experimenter needs to retrieve the segments from metric-hub as they
are currently not available there

This commit

* allows Experimenter to retrieve segments from metric-hub

Fixes #11242
This commit is contained in:
Rana Al-Khulaidi 2024-08-30 12:42:38 -04:00 коммит произвёл GitHub
Родитель 322964ed1e
Коммит 2a4388b2f3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
34 изменённых файлов: 5902 добавлений и 7 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -103,6 +103,12 @@ experimenter/experimenter/outcomes/metric-hub-main/*
experimenter/experimenter/outcomes/metric-hub-main/jetstream/* experimenter/experimenter/outcomes/metric-hub-main/jetstream/*
!experimenter/experimenter/outcomes/metric-hub-main/jetstream/outcomes/ !experimenter/experimenter/outcomes/metric-hub-main/jetstream/outcomes/
experimenter/experimenter/outcomes/metric-hub.zip experimenter/experimenter/outcomes/metric-hub.zip
experimenter/experimenter/segments/metric-hub-main/*
!experimenter/experimenter/segments/metric-hub-main/definitions/
!experimenter/experimenter/segments/metric-hub-main/jetstream/
experimenter/experimenter/segments/metric-hub-main/jetstream/*
!experimenter/experimenter/segments/metric-hub-main/jetstream/definitions/
experimenter/experimenter/segments/metric-hub.zip
# Versioning assets generated on build # Versioning assets generated on build
**/commit-description.txt **/commit-description.txt

Просмотреть файл

@ -81,6 +81,8 @@ jetstream_config:
curl -LJ -o experimenter/experimenter/outcomes/metric-hub.zip $(JETSTREAM_CONFIG_URL) curl -LJ -o experimenter/experimenter/outcomes/metric-hub.zip $(JETSTREAM_CONFIG_URL)
unzip -o -d experimenter/experimenter/outcomes experimenter/experimenter/outcomes/metric-hub.zip unzip -o -d experimenter/experimenter/outcomes experimenter/experimenter/outcomes/metric-hub.zip
rm -Rf experimenter/experimenter/outcomes/metric-hub-main/.script/ rm -Rf experimenter/experimenter/outcomes/metric-hub-main/.script/
unzip -o -d experimenter/experimenter/segments experimenter/experimenter/outcomes/metric-hub.zip
rm -Rf experimenter/experimenter/segments/metric-hub-main/.script/
feature_manifests: build_dev feature_manifests: build_dev
$(COMPOSE) run -e GITHUB_BEARER_TOKEN=$(GITHUB_BEARER_TOKEN) experimenter /experimenter/bin/manifest-tool.py fetch $(FETCH_ARGS) $(COMPOSE) run -e GITHUB_BEARER_TOKEN=$(GITHUB_BEARER_TOKEN) experimenter /experimenter/bin/manifest-tool.py fetch $(FETCH_ARGS)

Просмотреть файл

@ -3,7 +3,7 @@ from pathlib import Path
from django.test import override_settings from django.test import override_settings
mock_valid_outcomes = override_settings( mock_valid_outcomes = override_settings(
JETSTREAM_CONFIG_OUTCOMES_PATH=( METRIC_HUB_OUTCOMES_PATH=(
Path(__file__).parent.absolute() / "fixtures" / "valid_outcomes" Path(__file__).parent.absolute() / "fixtures" / "valid_outcomes"
), ),
) )

Просмотреть файл

@ -35,8 +35,8 @@ class Outcomes:
app_name_application_config = { app_name_application_config = {
a.app_name: a for a in NimbusConstants.APPLICATION_CONFIGS.values() a.app_name: a for a in NimbusConstants.APPLICATION_CONFIGS.values()
} }
for app_name in settings.JETSTREAM_CONFIG_OUTCOMES_PATH.iterdir(): for app_name in settings.METRIC_HUB_OUTCOMES_PATH.iterdir():
app_path = settings.JETSTREAM_CONFIG_OUTCOMES_PATH / app_name app_path = settings.METRIC_HUB_OUTCOMES_PATH / app_name
for outcome_name in app_path.iterdir(): for outcome_name in app_path.iterdir():
if outcome_name.suffix != ".example": if outcome_name.suffix != ".example":

Просмотреть файл

@ -3,13 +3,13 @@ from pathlib import Path
from django.test import override_settings from django.test import override_settings
mock_valid_outcomes = override_settings( mock_valid_outcomes = override_settings(
JETSTREAM_CONFIG_OUTCOMES_PATH=( METRIC_HUB_OUTCOMES_PATH=(
Path(__file__).parent.absolute() / "fixtures" / "valid_outcomes" Path(__file__).parent.absolute() / "fixtures" / "valid_outcomes"
), ),
) )
mock_invalid_outcomes = override_settings( mock_invalid_outcomes = override_settings(
JETSTREAM_CONFIG_OUTCOMES_PATH=( METRIC_HUB_OUTCOMES_PATH=(
Path(__file__).parent.absolute() / "fixtures" / "invalid_outcomes" Path(__file__).parent.absolute() / "fixtures" / "invalid_outcomes"
), ),
) )

Просмотреть файл

@ -0,0 +1,89 @@
from dataclasses import dataclass
import toml
from django.conf import settings
from django.core.checks import Error, register
from experimenter.experiments.constants import NimbusConstants
@dataclass
class Segment:
slug: str
friendly_name: str
application: str
description: str
select_expression: str
class Segments:
_segments = None
@classmethod
def _load_segments(cls):
segments: list[Segment] = []
app_name_application_config = {
a.app_name: a for a in NimbusConstants.APPLICATION_CONFIGS.values()
}
paths = [
settings.METRIC_HUB_SEGMENTS_PATH_JETSTREAM,
settings.METRIC_HUB_SEGMENTS_PATH_DEFAULT,
]
for path in paths:
for segment_file in path.iterdir():
if segment_file.is_file() and segment_file.suffix == ".toml":
app_name = segment_file.stem
with segment_file.open() as f:
segment_toml = f.read()
segment_data = toml.loads(segment_toml)
if "segments" in segment_data:
for slug, segment_info in segment_data["segments"].items():
if not slug or slug == "data_sources":
continue
segments.append(
Segment(
slug=slug,
friendly_name=segment_info["friendly_name"],
application=app_name_application_config[
app_name
].slug,
description=segment_info.get("description", ""),
select_expression=segment_info.get(
"select_expression", ""
),
)
)
return segments
@classmethod
def clear_cache(cls):
cls._segments = None
@classmethod
def all(cls):
if cls._segments is None:
cls._segments = cls._load_segments()
return cls._segments
@classmethod
def by_application(cls, application):
return [o for o in cls.all() if o.application == application]
@register()
def check_segment_tomls(app_configs, **kwargs):
errors = []
try:
Segments.all()
except Exception as e:
errors.append(Error(f"Error loading Segment TOMLS: {e}"))
return errors

Просмотреть файл

@ -0,0 +1,4 @@
# Definitions
This directory contains definitions for specific metrics, data sources, dimensions or segments for the platform they target.
These definitions can be referenced in project specific configuration files without having to be redefined.

Просмотреть файл

@ -0,0 +1,731 @@
[metrics]
[metrics.uri_count]
data_source = "baseline"
select_expression = '{{agg_sum("metrics.counter.events_normal_and_private_uri_count")}}'
friendly_name = "URIs visited"
description = "Counts the number of URIs each client visited"
[metrics.active_hours]
select_expression = "COALESCE(SUM(metrics.timespan.glean_baseline_duration.value), 0) / 3600.0"
data_source = "baseline"
friendly_name = "Active Hours"
description = "Total time Firefox was active"
[metrics.days_of_use]
friendly_name = "Days of use"
description = "The number of days in an observation window that clients used the browser."
select_expression = "COUNT(DISTINCT DATE(submission_timestamp))"
data_source = "baseline"
[metrics.daily_active_users]
data_source = "baseline_v2"
select_expression = "COUNT(DISTINCT CASE WHEN LOWER(metadata.isp.name) != 'browserstack' THEN client_info.client_id ELSE NULL END)"
type = "scalar"
friendly_name = "DAU"
description = """
The number of unique clients that we received a baseline ping from each day, excluding
pings originating from BrowserStack. To be comparable to DAU used for KPI tracking,
this metric needs to be aggregated by `submission_date`. If the metric is NOT
aggregated by `submission_date`, the metric is similar to a "days of use" metric. For more details, refer to
[the DAU description in the Mozilla Data Documentation](https://docs.telemetry.mozilla.org/concepts/terminology.html#dau).
For questions, please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
category = "KPI"
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.daily_active_users_v2]
data_source = "fenix_active_users_aggregates_view"
select_expression = "SUM(dau)"
type = "scalar"
friendly_name = "Fenix DAU"
description = """
This is the official DAU reporting definition. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
Whenever possible, this is the preferred DAU reporting definition to use for Fenix.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`,
it is similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.client_level_daily_active_users_v1]
data_source = "baseline_v2"
select_expression = "COUNT(DISTINCT CASE WHEN LOWER(metadata.isp.name) != 'browserstack' THEN client_info.client_id ELSE NULL END)"
type = "scalar"
friendly_name = "Fenix Client-Level DAU"
description = """
This metric reports DAU values similar (but not necessarily identical)
to the [official DAU reporting definition](https://mozilla.github.io/metric-hub/metrics/fenix/#daily_active_users_v2).
It's generally preferable to use the official DAU reporting definition when possible; this metric
exists only for cases where reporting `client_id` is required (e.g. for experiments). This metric
needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.client_level_daily_active_users_v2]
data_source = "baseline_v2"
select_expression = """
COUNT(DISTINCT CASE WHEN metrics.timespan.glean_baseline_duration.value > 0
AND LOWER(metadata.isp.name) != 'browserstack'
THEN client_info.client_id
ELSE NULL END)
"""
type = "scalar"
friendly_name = "Fenix Client-Level DAU"
description = """
This metric reports DAU values similar (but not necessarily identical)
to the [official DAU reporting definition](https://mozilla.github.io/metric-hub/metrics/fenix/#daily_active_users_v2).
It's generally preferable to use the official DAU reporting definition when possible; this metric
exists only for cases where reporting `client_id` is required (e.g. for experiments). This metric
needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.client_level_daily_active_users_v3]
friendly_name = "Fenix Client-Level DAU"
data_source = "fenix_active_users_view"
select_expression = """COUNTIF(is_dau)"""
type = "scalar"
description = """
Client-level DAU. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.user_reports_site_issue_count]
data_source = "events"
select_expression = """
COUNTIF(event.name = 'browser_menu_action' AND
mozfun.map.get_key(event.extra, 'item') = 'report_site_issue')
"""
friendly_name = "Site issues reported"
description = "Counts the number of times clients reported an issue with a site."
[metrics.user_reload_count]
data_source = "events"
select_expression = """
COUNTIF(event.name = 'browser_menu_action' AND
mozfun.map.get_key(event.extra, 'item') = 'reload')
"""
friendly_name = "Pages reloaded"
description = "Counts the number of times a client reloaded a page."
bigger_is_better = false
[metrics.baseline_ping_count]
data_source = "baseline"
select_expression = "COUNT(document_id)"
friendly_name = "Baseline pings"
description = "Counts the number of `baseline` pings received from each client."
[metrics.metric_ping_count]
data_source = "metrics"
select_expression = "COUNT(document_id)"
friendly_name = "Metrics pings"
description = "Counts the number of `metrics` pings received from each client."
[metrics.first_run_date]
data_source = "baseline"
select_expression = "MIN(client_info.first_run_date)"
friendly_name = "First run date"
description = "The earliest first-run date reported by each client."
[metrics.performance_pageload_load_time]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.performance_pageload_load_time IGNORE NULLS)"
friendly_name = "Pageload Load Time"
description = "Time in milliseconds from navigationStart to loadEventStart for the foreground http or https root content document."
category = "performance"
type = "histogram"
[metrics.performance_pageload_load_time_responsestart]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.performance_pageload_load_time_responsestart IGNORE NULLS)"
friendly_name = "Pageload Load Time Response Start"
description = "Time in milliseconds from responseStart to loadEventStart for the foreground http or https root content document."
category = "performance"
type = "histogram"
[metrics.performance_page_non_blank_paint]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.performance_page_non_blank_paint IGNORE NULLS)"
friendly_name = "Page Non Blank Paint"
description = "The time between navigationStart and the first non-blank paint of a foreground root content document, in milliseconds."
category = "performance"
type = "histogram"
[metrics.performance_pageload_req_anim_frame_callback]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.performance_pageload_req_anim_frame_callback IGNORE NULLS)"
friendly_name = "Pageload Load Req Animation Frame Callback"
description = "Time spent in milliseconds calling all request animation frame callbacks for a document before it has reached readystate complete."
category = "performance"
type = "histogram"
[metrics.performance_pageload_dcl]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.performance_pageload_dcl IGNORE NULLS)"
friendly_name = "Pageload DCL"
description = "Time in milliseconds from navigationStart to domContentLoaded for the foreground http or https root content document."
category = "performance"
type = "histogram"
[metrics.performance_pageload_dcl_responsestart]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.performance_pageload_dcl_responsestart IGNORE NULLS)"
friendly_name = "Pageload DCL Response Start"
description = "Time in milliseconds from responseStart to domContentLoaded for the foreground http or https root content document."
category = "performance"
type = "histogram"
[metrics.performance_pageload_fcp]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.performance_pageload_fcp IGNORE NULLS)"
friendly_name = "Pageload FCP"
description = "The time between navigationStart and the first contentful paint of a foreground http or https root content document, in milliseconds. The contentful paint timestamp is taken during display list building and does not include rasterization or compositing of that paint."
category = "performance"
type = "histogram"
[metrics.performance_pageload_fcp_responsestart]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.performance_pageload_fcp_responsestart IGNORE NULLS)"
friendly_name = "Pageload FCP Response Start"
description = "The time between responseStart and the first contentful paint of a foreground http or https root content document, in milliseconds. The contentful paint timestamp is taken during display list building and does not include rasterization or compositing of that paint."
category = "performance"
type = "histogram"
[metrics.perf_startup_cold_main_app_to_first_frame]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.perf_startup_cold_main_app_to_first_frame IGNORE NULLS)"
friendly_name = "Startup Cold Main App to First Frame"
description = "The duration from `*Application`'s initializer to the first Android frame\nbeing drawn in a [COLD MAIN start\nup](https://wiki.mozilla.org/index.php?title=Performance/Fenix/Glossary)."
category = "performance"
type = "histogram"
[metrics.perf_startup_cold_view_app_to_first_frame]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.timing_distribution.perf_startup_cold_view_app_to_first_frame IGNORE NULLS)"
friendly_name = "Startup Cold View App to First Frame"
description = "The duration from `*Application`'s initializer to the first Android frame\nbeing drawn in a [COLD VIEW start\nup](https://wiki.mozilla.org/index.php?title=Performance/Fenix/Glossary)."
category = "performance"
type = "histogram"
[metrics.storage_stats_app_bytes]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.memory_distribution.storage_stats_app_bytes IGNORE NULLS)"
friendly_name = "App Byte Size"
description = "The size of the app's APK and related files as installed: this is expected\nto be larger than download size."
category = "performance"
type = "histogram"
[metrics.storage_stats_cache_bytes]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.memory_distribution.storage_stats_cache_bytes IGNORE NULLS)"
friendly_name = "Cache Byte Size"
description = "The size of all cached data in the app."
category = "performance"
type = "histogram"
[metrics.storage_stats_data_dir_bytes]
data_source = "metrics"
select_expression = "ARRAY_AGG(metrics.memory_distribution.storage_stats_data_dir_bytes IGNORE NULLS)"
friendly_name = "Data Dir Byte Size"
description = "The size of all data minus `cache_bytes`."
category = "performance"
type = "histogram"
#### search metrics
[metrics.tagged_sap_searches]
select_expression = "{{agg_sum('tagged_sap')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Tagged SAP Searches"
description = "Total number of tagged SAP searches. This metric is deprecated, use tagged_search_count instead"
deprecated = true
[metrics.organic_search_count]
friendly_name = "Organic searches"
description = """
Counts organic searches, which are searches that are _not_ performed
through a Firefox SAP and which are not monetizable.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.ad_click_organic]
friendly_name = "Organic Ad Click Count"
description = "Total number of Organic Ad Click Counts"
select_expression = "{{agg_sum('ad_click_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads_organic]
friendly_name = "Organic Search With Ads Count"
description = "Total number of Organic Search With Ads Counts"
select_expression = "{{agg_sum('search_with_ads_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.search_count]
friendly_name = "SAP searches"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('search_count')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads]
friendly_name = "Search result pages with ads"
description = """
Counts search result pages served with advertising.
Users may not actually see these ads thanks to e.g. ad-blockers.
Learn more in the
[search analysis documentation](https://mozilla-private.report/search-analysis-docs/book/in_content_searches.html).
"""
category = "search"
type = "scalar"
select_expression = "{{agg_sum('search_with_ads')}}"
data_source = "mobile_search_clients_engines_sources_daily"
owner = "xluo-all@mozilla.com"
[metrics.ad_clicks]
select_expression = "{{agg_sum('ad_click')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Ad clicks"
description = """
Counts clicks on ads on search engine result pages with a Mozilla
partner tag.
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_search_count]
select_expression = "{{agg_sum('tagged_sap')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Tagged SAP searches"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points that were submitted with a partner code
and were potentially revenue-generating.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_follow_on]
select_expression = "{{agg_sum('tagged_follow_on')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Tagged follow-on searches"
description = """
Counts the number of follow-on searches with a Mozilla partner tag.
These are additional searches that users performed from a search engine
results page after executing a tagged search through a SAP.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
### Sponsored Tiles metrics
[metrics.spoc_tiles_impressions]
select_expression = """
COALESCE(COUNTIF(
event.category = 'top_sites'
AND event.name = 'contile_impression'
),0)
"""
data_source = "events"
friendly_name = "Sponsored Tiles Impressions"
description = "Number of times Contile Sponsored Tiles are shown."
owner = "xluo-all@mozilla.com"
[metrics.spoc_tiles_clicks]
select_expression = """
COALESCE(COUNTIF(
event.category = 'top_sites'
AND event.name = 'contile_click'
),0)
"""
data_source = "events"
friendly_name = "Sponsored Tiles Clicks"
description = "Number of times user clicked a Contile Sponsored Tile."
owner = "xluo-all@mozilla.com"
[metrics.spoc_tiles_disable_rate]
select_expression = """
COALESCE(MAX(
CAST(
metrics.boolean.customize_home_contile AS int )
),0)
"""
data_source = "metrics"
bigger_is_better = false
friendly_name = "Sponsored Tiles Disable Rate"
description = "Fraction of users who disable Contile Sponsored Tiles"
owner = "xluo-all@mozilla.com"
[metrics.spoc_tiles_preference_toggled]
select_expression = """
COALESCE(SUM(CASE WHEN
event.category = 'customize_home'
AND event.name = 'preference_toggled'
AND `mozfun.map.get_key`(event.extra, 'preference_key') = 'contile'
THEN 1 ELSE 0 END
),0)
"""
data_source = "events"
bigger_is_better = false
friendly_name = "Sponsored Tiles Preference Toggled"
description = "Number of times Contile Sponsored Tiles setting is flipped."
owner = "xluo-all@mozilla.com"
[metrics.new_profile_activation]
select_expression = "COALESCE(SUM(activated))"
data_source = "new_profile_activation"
friendly_name = "New Profile Activation"
description = "A new profile is counted as activated one week after creation if it meets the following conditions: 1) at least 3 days of use during first week 2) at least one search between days 4-7."
owner = "vsabino@mozilla.com"
[metrics.fxa_sign_in]
select_expression = """MAX(IF(metrics.boolean.preferences_signed_in_sync, 1, 0))"""
data_source = "metrics"
friendly_name = "Firefox Accounts Signed In"
description = "Whether a user was signed into FxA at any point in the period"
owner = "loines@mozilla.com"
[metrics.turn_on_notifications_ctr_onboarding]
select_expression = "COALESCE(SUM(turn_on_notifications_flag))"
data_source = "special_onboarding_events"
friendly_name = "Turn on Notification Click"
description = "This metric looks at proportion of all new profiles that were exposed to the turn on notification card and clicked the action during on-boarding."
owner = "rbaffourawuah@mozilla.com"
[metrics.set_to_default_ctr_onboarding]
select_expression = "COALESCE(SUM(set_to_default_flag))"
data_source = "special_onboarding_events"
friendly_name = "Set to Default Click"
description = "This metric looks at proportion of all new profiles that were exposed to the set to default card and clicked the action during on-boarding."
owner = "rbaffourawuah@mozilla.com"
[metrics.sign_in_ctr_onboarding]
select_expression = "COALESCE(SUM(sign_in_flag))"
data_source = "special_onboarding_events"
friendly_name = "Sign in Click"
description = "This metric looks at proportion of all new profiles that were exposed to the sign-in card and clicked the action during on-boarding."
owner = "rbaffourawuah@mozilla.com"
[metrics.at_least_1_cta_ctr_onboarding]
select_expression = "COALESCE(SUM(at_least_1_cta))"
data_source = "special_onboarding_events"
friendly_name = "Clicked at least one CTA"
description = "This metric looks at proportion of all new profiles that were exposed to onboarding cards and clicked at least one action during on-boarding."
owner = "rbaffourawuah@mozilla.com"
[metrics.bookmarks_add_v1]
select_expression = "SUM(bookmarks_add)"
data_source = "feature_usage_metrics_v1"
friendly_name = "Added Bookmarks"
description = "Number of Added Bookmarks"
owner = "rzhao@mozilla.com"
[metrics.bookmarks_delete_v1]
select_expression = "SUM(bookmarks_delete)"
data_source = "feature_usage_metrics_v1"
friendly_name = "Deleted Bookmarks"
description = "Number of Deleted Bookmarks"
owner = "rzhao@mozilla.com"
[metrics.bookmarks_add_users_v1]
select_expression = "SUM(bookmarks_add_users)"
data_source = "feature_usage_metrics_v1"
friendly_name = "Added Bookmarks Users"
description = "Number of Users that Added Bookmarks"
owner = "rzhao@mozilla.com"
[metrics.bookmarks_delete_users_v1]
select_expression = "SUM(bookmarks_delete_users)"
data_source = "feature_usage_metrics_v1"
friendly_name = "Deleted Bookmarks Users"
description = "Number of Users that Deleted Bookmarks"
owner = "rzhao@mozilla.com"
[metrics.engagement_rate_v1]
friendly_name = "Fenix Engagement Rate"
data_source = "fenix_engagement_view"
select_expression = "SUM(dau) / SUM(mau)"
type = "scalar"
description = """
The Engagement Rate is calculated as the ratio between DAU and MAU. For each day, we use the single-day DAU number and divide
it by the MAU corresponding to the 28-day period ending on that day. For OKR reporting, we then calculate a
28-day moving average of this number. More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#Engagement-Rate).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.retention_rate_v1]
friendly_name = "Fenix Retention Rate"
data_source = "fenix_retention_view"
select_expression = "SUM(retained_week_4) / SUM(active_metric_date)"
type = "scalar"
description = """
The Retention Rate is calculated as the proportion of clients that are active on the 4th week after the metric date.
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.new_profile_retention_rate_v1]
friendly_name = "Fenix New Proflie Retention Rate"
data_source = "fenix_retention_view"
select_expression = "SUM(retained_week_4_new_profiles) / SUM(new_profiles_metric_date)"
type = "scalar"
description = """
The New Profile Retention Rate is calculated as the proportion of new profiles that are active on the 4th week after the metric date.
More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#New-Profile-Retention).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[data_sources]
[data_sources.fenix_active_users_aggregates_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.telemetry.active_users_aggregates`
WHERE app_name = 'Fenix'
)"""
friendly_name = "Active Users Aggregates"
description = "Active Users Aggregates, filtered on Fenix"
submission_date_column = "submission_date"
client_id_column = "NULL" # this table doesn't include client_id, and we don't need it for calculating DAU
[data_sources.baseline]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_firefox"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.baseline_v2]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
submission_date_column = "submission_date"
default_dataset = "fenix"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.events]
from_expression = """(
SELECT
p.* EXCEPT (events),
DATE(p.submission_timestamp) AS submission_date,
event
FROM
`moz-fx-data-shared-prod.{dataset}.events` p
CROSS JOIN
UNNEST(p.events) AS event
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_firefox"
friendly_name = "Events"
description = "Events Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.metrics]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.metrics` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_firefox"
friendly_name = "Metrics"
description = "Metrics Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.mobile_search_clients_engines_sources_daily]
from_expression = """(
SELECT *
FROM `mozdata.search.mobile_search_clients_engines_sources_daily`
WHERE normalized_app_name_os = 'Firefox Android'
)"""
experiments_column_type = "simple"
client_id_column = "client_id"
submission_date_column = "submission_date"
[data_sources.new_profile_activation]
from_expression = "`moz-fx-data-shared-prod.fenix.new_profile_activation`"
experiments_column_type = "none"
[data_sources.special_onboarding_events]
from_expression = """(
SELECT
expo.submission_date
, expo.client_id
, case when (conv.set_to_default >= 1 AND expo.set_to_default_card >= 1) then 1
when (coalesce(conv.set_to_default, 0) = 0 AND expo.set_to_default_card >= 1) then 0 else null end as set_to_default_flag
, case when (conv.turn_on_notifications >= 1 AND expo.turn_on_notifications_card >= 1) then 1
when (coalesce(conv.turn_on_notifications, 0) = 0 AND expo.turn_on_notifications_card >= 1) then 0 else null end as turn_on_notifications_flag
, case when (conv.sign_in >= 1 AND expo.sign_in_card >= 1) then 1
when (coalesce(conv.sign_in,0) = 0 AND expo.sign_in_card >= 1) then 0 else null end as sign_in_flag
, case when (conv.set_to_default >= 1 AND expo.set_to_default_card >= 1) OR (conv.turn_on_notifications >= 1 AND expo.turn_on_notifications_card >= 1) OR (conv.sign_in >= 1 AND expo.sign_in_card >= 1)then 1
when (coalesce(conv.set_to_default, 0) = 0 AND coalesce(conv.turn_on_notifications, 0) = 0 AND coalesce(conv.sign_in,0) = 0) AND (set_to_default_card >= 1 OR turn_on_notifications_card >= 1 OR sign_in_card >= 1) then 0 else null end as at_least_1_cta
FROM (
SELECT
client_info.client_id as client_id
, min(DATE(submission_timestamp)) as submission_date
, count(case when event.name = "set_to_default_card" then DATE(submission_timestamp) END) as set_to_default_card
, count(case when event.name = "turn_on_notifications_card" then DATE(submission_timestamp) END) as turn_on_notifications_card
, count(case when event.name = "sign_in_card" then DATE(submission_timestamp) END) as sign_in_card
FROM
`mozdata.org_mozilla_firefox.events` tm
CROSS JOIN
UNNEST(events) AS event
CROSS JOIN
UNNEST(event.extra) AS ext
WHERE event.category = "onboarding" AND ext.value ="impression" AND event.name in ("set_to_default_card", "turn_on_notifications_card", "sign_in_card")
AND DATE(submission_timestamp) >= "2023-01-01"
GROUP BY 1
) expo
LEFT JOIN (
SELECT
client_info.client_id as client_id
, count(case when event.name = "set_to_default" then DATE(submission_timestamp) END) as set_to_default
, count(case when event.name = "turn_on_notifications" then DATE(submission_timestamp) END) as turn_on_notifications
, count(case when event.name = "sign_in" then DATE(submission_timestamp) END) as sign_in
FROM
`mozdata.org_mozilla_firefox.events` tm
CROSS JOIN
UNNEST(events) AS event
CROSS JOIN
UNNEST(event.extra) AS ext
WHERE event.category = "onboarding" AND ext.key ="action" AND event.name in ("set_to_default", "turn_on_notifications", "sign_in")
AND DATE(submission_timestamp) >= "2023-01-01"
GROUP BY 1
) conv
ON expo.client_id = conv.client_id
GROUP BY 1, 2, 3, 4, 5, 6
)
"""
experiments_column_type = "none"
[data_sources.feature_usage_metrics_v1]
from_expression = """(
SELECT
*
FROM `mozdata.fenix.feature_usage_metrics` p
LEFT JOIN (
SELECT
submission_date,
SUM(dau) AS dau
FROM `mozdata.telemetry.active_users_aggregates`
WHERE app_name = 'Fenix'
GROUP BY submission_date
)
USING(submission_date)
)"""
client_id_column = "NULL"
friendly_name = "Feature Usage Metrics"
description = "Fenix feature usage metrics"
[data_sources.fenix_engagement_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.fenix.engagement`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
description = "Aggregated DAU, WAU, and MAU by different attributes for engagement ratio calculation."
friendly_name = "Fenix Engagement"
client_id_column = "NULL"
[data_sources.fenix_retention_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.fenix.retention`
WHERE is_mobile
)"""
submission_date_column = "metric_date"
description = "Aggregated 4th Week Retention Outcomes of Fenix New and Existing Users."
friendly_name = "Fenix Retention"
client_id_column = "NULL"
[data_sources.fenix_active_users_view]
friendly_name = "Fenix Active Users"
description = "Client-level table that indicates whether a client meets 'active user' criteria on a given submission_date."
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.fenix.active_users`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
client_id_column = "client_id"
deprecated = false

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,617 @@
[metrics]
[metrics.baseline_ping_count]
data_source = "baseline"
select_expression = "COUNT(document_id)"
friendly_name = "Baseline pings"
description = "Counts the number of `baseline` pings received from each client."
[metrics.metric_ping_count]
data_source = "metrics"
select_expression = "COUNT(document_id)"
friendly_name = "Metrics pings"
description = "Counts the number of `metrics` pings received from each client."
[metrics.first_run_date]
data_source = "baseline"
select_expression = "MIN(client_info.first_run_date)"
friendly_name = "First run date"
description = "The earliest first-run date reported by each client."
[metrics.active_hours]
select_expression = "COALESCE(SUM(metrics.timespan.glean_baseline_duration.value), 0) / 3600.0"
data_source = "baseline"
friendly_name = "Active Hours"
description = "Total time Firefox was active"
[metrics.days_of_use]
friendly_name = "Days of use"
description = "The number of days in an observation window that clients used the browser."
select_expression = "COUNT(DISTINCT DATE(submission_timestamp))"
data_source = "baseline"
[metrics.daily_active_users]
data_source = "baseline_v2"
select_expression = "COUNT(DISTINCT CASE WHEN LOWER(metadata.isp.name) != 'browserstack' THEN client_info.client_id ELSE NULL END)"
type = "scalar"
friendly_name = "DAU"
description = """
The number of unique clients that we received a baseline ping from each day, excluding
pings originating from BrowserStack. To be comparable to DAU used for KPI tracking,
this metric needs to be aggregated by `submission_date`. If the metric is NOT
aggregated by `submission_date`, the metric is similar to a "days of use" metric. For more details, refer to
[the DAU description in the Mozilla Data Documentation](https://docs.telemetry.mozilla.org/concepts/terminology.html#dau).
For questions, please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
category = "KPI"
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.daily_active_users_v2]
data_source = "firefox_ios_active_users_aggregates_view"
select_expression = "SUM(dau)"
type = "scalar"
friendly_name = "Firefox iOS DAU"
description = """
This is the official DAU reporting definition. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
Whenever possible, this is the preferred DAU reporting definition to use for Firefox iOS.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`,
it is similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.client_level_daily_active_users_v1]
data_source = "baseline_v2"
select_expression = "COUNT(DISTINCT CASE WHEN LOWER(metadata.isp.name) != 'browserstack' THEN client_info.client_id ELSE NULL END)"
type = "scalar"
friendly_name = "Firefox iOS Client-Level DAU"
description = """
This metric reports DAU values similar (but not necessarily identical)
to the [official DAU reporting definition](https://mozilla.github.io/metric-hub/metrics/firefox_ios/#daily_active_users_v2).
It's generally preferable to use the official DAU reporting definition when possible; this metric
exists only for cases where reporting `client_id` is required (e.g. for experiments). This metric
needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.client_level_daily_active_users_v2]
data_source = "baseline_v2"
select_expression = """
COUNT(DISTINCT CASE WHEN metrics.timespan.glean_baseline_duration.value > 0
AND LOWER(metadata.isp.name) != 'browserstack'
THEN client_info.client_id
ELSE NULL END)
"""
type = "scalar"
friendly_name = "Firefox iOS Client-Level DAU"
description = """
This metric reports DAU values similar (but not necessarily identical)
to the [official DAU reporting definition](https://mozilla.github.io/metric-hub/metrics/firefox_ios/#daily_active_users_v2).
It's generally preferable to use the official DAU reporting definition when possible; this metric
exists only for cases where reporting `client_id` is required (e.g. for experiments). This metric
needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.client_level_daily_active_users_v3]
friendly_name = "Firefox iOS Client-Level DAU"
data_source = "firefox_ios_active_users_view"
select_expression = """COUNTIF(is_dau)"""
type = "scalar"
description = """
Client-level DAU. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
## search metrics
[metrics.organic_search_count]
friendly_name = "Organic searches"
description = """
Counts organic searches, which are searches that are _not_ performed
through a Firefox SAP and which are not monetizable.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.ad_click_organic]
friendly_name = "Organic Ad Click Count"
description = "Total number of Organic Ad Click Counts"
select_expression = "{{agg_sum('ad_click_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads_organic]
friendly_name = "Organic Search With Ads Count"
description = "Total number of Organic Search With Ads Counts"
select_expression = "{{agg_sum('search_with_ads_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.search_count]
friendly_name = "SAP searches"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('search_count')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads]
friendly_name = "Search result pages with ads"
description = """
Counts search result pages served with advertising.
Users may not actually see these ads thanks to e.g. ad-blockers.
Learn more in the
[search analysis documentation](https://mozilla-private.report/search-analysis-docs/book/in_content_searches.html).
"""
category = "search"
type = "scalar"
select_expression = "{{agg_sum('search_with_ads')}}"
data_source = "mobile_search_clients_engines_sources_daily"
owner = "xluo-all@mozilla.com"
[metrics.ad_clicks]
select_expression = "{{agg_sum('ad_click')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Ad clicks"
description = """
Counts clicks on ads on search engine result pages with a Mozilla
partner tag.
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_search_count]
select_expression = "{{agg_sum('tagged_sap')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Tagged SAP searches"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points that were submitted with a partner code
and were potentially revenue-generating.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_follow_on]
select_expression = "{{agg_sum('tagged_follow_on')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Tagged follow-on searches"
description = """
Counts the number of follow-on searches with a Mozilla partner tag.
These are additional searches that users performed from a search engine
results page after executing a tagged search through a SAP.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
## Sponsored Tiles metrics
[metrics.spoc_tiles_impressions]
select_expression = """
COALESCE(COUNTIF(
event.category = 'top_site'
AND event.name = 'contile_impression'
),0)
"""
data_source = "events"
friendly_name = "Sponsored Tiles Impressions"
description = "Number of times Contile Sponsored Tiles are shown."
owner = "xluo-all@mozilla.com"
[metrics.spoc_tiles_clicks]
select_expression = """
COALESCE(COUNTIF(
event.category = 'top_site'
AND event.name = 'contile_click'
),0)
"""
data_source = "events"
friendly_name = "Sponsored Tiles Clicks"
description = "Number of times user clicked a Contile Sponsored Tile."
owner = "xluo-all@mozilla.com"
[metrics.spoc_tiles_preference_toggled]
select_expression = """
COALESCE(SUM(CASE WHEN
event.category = 'preferences'
AND event.name = 'changed'
AND `mozfun.map.get_key`(event.extra, 'preference') = 'sponsoredTiles'
THEN 1 ELSE 0 END
),0)
"""
data_source = "events"
bigger_is_better = false
friendly_name = "Sponsored Tiles Preference Toggled"
description = "Number of times Contile Sponsored Tiles setting is flipped."
owner = "xluo-all@mozilla.com"
[metrics.new_profile_activation]
select_expression = "COUNTIF(is_activated)"
data_source = "new_profile_activation"
friendly_name = "New Profile Activation"
description = "A new profile is counted as activated one week after creation if it meets the following conditions: 1) at least 3 days of use during first week 2) at least one search between days 4-7."
owner = "vsabino@mozilla.com"
[metrics.turn_on_notifications_ctr_onboarding]
select_expression = "COALESCE(SUM(turn_on_notifications_flag))"
data_source = "special_onboarding_events"
friendly_name = "Turn on Notification Click"
description = "This metric looks at proportion of all new profiles that were exposed to the turn on notification card and clicked the action during on-boarding."
owner = "rbaffourawuah@mozilla.com"
[metrics.set_to_default_ctr_onboarding]
select_expression = "COALESCE(SUM(set_to_default_flag))"
data_source = "special_onboarding_events"
friendly_name = "Set to Default Click"
description = "This metric looks at proportion of all new profiles that were exposed to the set to default card and clicked the action during on-boarding."
owner = "rbaffourawuah@mozilla.com"
[metrics.sign_in_ctr_onboarding]
select_expression = "COALESCE(SUM(sign_in_flag))"
data_source = "special_onboarding_events"
friendly_name = "Sign in Click"
description = "This metric looks at proportion of all new profiles that were exposed to the sign-in card and clicked the action during on-boarding."
owner = "rbaffourawuah@mozilla.com"
[metrics.at_least_1_cta_ctr_onboarding]
select_expression = "COALESCE(SUM(at_least_1_cta))"
data_source = "special_onboarding_events"
friendly_name = "Clicked at least one CTA"
description = "This metric looks at proportion of all new profiles that were exposed to onboarding cards and clicked at least one action during on-boarding."
owner = "rbaffourawuah@mozilla.com"
[metrics.impressions]
data_source = "appstore_funnel"
select_expression = "SUM(impressions)"
type = "scalar"
friendly_name = "Firefox iOS appstore impressions"
description = """
This is the number of unique impressions of firefox browser in iOS appstore. The etl of the base table is
[defined in `bigquery-etl`](https://github.com/mozilla/bigquery-etl/blob/main/sql/moz-fx-data-shared-prod/firefox_ios_derived/app_store_funnel_v1/query.sql).
This metric needs to be aggregated by `first_seen_date` (date column from the data recieved from appstore) for daily aggregation. The underlying table have a lag of 7 days.
For questions please contact "rbaffourawuah@mozilla.com".
"""
owner = "rbaffourawuah@mozilla.com"
deprecated = false
[metrics.downloads]
data_source = "appstore_funnel"
select_expression = "SUM(total_downloads)"
type = "scalar"
friendly_name = "Firefox iOS appstore downloads"
description = """
This is the total number of downloads of firefox browser in iOS appstore. The etl of the base table is
[defined in `bigquery-etl`](https://github.com/mozilla/bigquery-etl/blob/main/sql/moz-fx-data-shared-prod/firefox_ios_derived/app_store_funnel_v1/query.sql).
This metric needs to be aggregated by `first_seen_date` (date column from the data recieved from appstore) for daily aggregation. The underlying table have a lag of 7 days.
For questions please contact "rbaffourawuah@mozilla.com".
"""
owner = "rbaffourawuah@mozilla.com"
deprecated = false
[metrics.funnel_new_profiles]
data_source = "funnel_retention"
select_expression = "SUM(new_profiles)"
type = "scalar"
friendly_name = "Firefox iOS funnel new profiles"
description = """
This is the total number of new profiles created on a given date. We only count new profiles that came via release channel and we also filter out app version 107.2 data that was recieved after February 1st. The etl of the base table is
[defined in `bigquery-etl`](https://github.com/mozilla/bigquery-etl/blob/main/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_week_4_v1/query.sql).
This metric needs to be aggregated by `first_seen_date` for daily aggregation. The underlying table have a lag of 28 days, this means the most recent completed first seen date will be 28 days from current date.
For questions please contact "rbaffourawuah@mozilla.com".
"""
owner = "rbaffourawuah@mozilla.com"
deprecated = false
[metrics.repeat_users]
data_source = "funnel_retention"
select_expression = "SUM(repeat_user)"
type = "scalar"
friendly_name = "Firefox iOS funnel repeat users"
description = """
This is the total number of new profiles that visited more than once within their first 28 days. All the filters applied to new profile counts is applied to this calculation. The etl of the base table is
[defined in `bigquery-etl`](https://github.com/mozilla/bigquery-etl/blob/main/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_week_4_v1/query.sql).
This metric needs to be aggregated by `first_seen_date` for daily aggregation. The underlying table have a lag of 28 days, this means the most recent completed first seen date will be 28 days from current date.
For questions please contact "rbaffourawuah@mozilla.com".
"""
owner = "rbaffourawuah@mozilla.com"
deprecated = false
[metrics.week_4_retained_users]
data_source = "funnel_retention"
select_expression = "SUM(retained_week_4)"
type = "scalar"
friendly_name = "Firefox iOS funnel week 4 retained users"
description = """
This is the total number of new profiles that returned between between day 22 to day 28 after first seen. All the filters applied to new profile counts is applied to this calculation. The etl of the base table is
[defined in `bigquery-etl`](https://github.com/mozilla/bigquery-etl/blob/main/sql/moz-fx-data-shared-prod/firefox_ios_derived/funnel_retention_week_4_v1/query.sql).
This metric needs to be aggregated by `first_seen_date` for daily aggregation. The underlying table have a lag of 28 days, this means the most recent completed first seen date will be 28 days from current date.
For questions please contact "rbaffourawuah@mozilla.com".
"""
owner = "rbaffourawuah@mozilla.com"
deprecated = false
[metrics.engagement_rate_v1]
friendly_name = "Firefox iOS Engagement Rate"
data_source = "firefox_ios_engagement_view"
select_expression = "SUM(dau) / SUM(mau)"
type = "scalar"
description = """
The Engagement Rate is calculated as the ratio between DAU and MAU. For each day, we use the single-day DAU number and divide
it by the MAU corresponding to the 28-day period ending on that day. For OKR reporting, we then calculate a
28-day moving average of this number. More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#Engagement-Rate).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.retention_rate_v1]
friendly_name = "Firefox iOS Retention Rate"
data_source = "firefox_ios_retention_view"
select_expression = "SUM(retained_week_4) / SUM(active_metric_date)"
type = "scalar"
description = """
The Retention Rate is calculated as the proportion of clients that are active on the 4th week after the metric date.
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.new_profile_retention_rate_v1]
friendly_name = "Firefox iOS New Proflie Retention Rate"
data_source = "firefox_ios_retention_view"
select_expression = "SUM(retained_week_4_new_profiles) / SUM(new_profiles_metric_date)"
type = "scalar"
description = """
The New Profile Retention Rate is calculated as the proportion of new profiles that are active on the 4th week after the metric date.
More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#New-Profile-Retention).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[data_sources]
[data_sources.firefox_ios_active_users_aggregates_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.telemetry.active_users_aggregates`
WHERE app_name = 'Firefox iOS'
)"""
friendly_name = "Active Users Aggregates"
description = "Active Users Aggregates, filtered on Firefox iOS"
submission_date_column = "submission_date"
client_id_column = "NULL" # this table doesn't include client_id, and we don't need it for calculating DAU
[data_sources.baseline]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_firefox"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.baseline_v2]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
submission_date_column = "submission_date"
experiments_column_type = "glean"
default_dataset = "firefox_ios"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.events]
from_expression = """(
SELECT
p.* EXCEPT (events),
DATE(p.submission_timestamp) AS submission_date,
event
FROM
`moz-fx-data-shared-prod.{dataset}.events` p
CROSS JOIN
UNNEST(p.events) AS event
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_firefox"
friendly_name = "Events"
description = "Events Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.metrics]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.metrics` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_firefox"
friendly_name = "Metrics"
description = "Metrics Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.mobile_search_clients_engines_sources_daily]
from_expression = """(
SELECT *
FROM `mozdata.search.mobile_search_clients_engines_sources_daily`
WHERE normalized_app_name_os = 'Firefox iOS'
)"""
experiments_column_type = "simple"
client_id_column = "client_id"
submission_date_column = "submission_date"
[data_sources.new_profile_activation]
from_expression = "`mozdata.firefox_ios.clients_activation`"
experiments_column_type = "none"
[data_sources.special_onboarding_events]
from_expression = """(
SELECT
expo.submission_date
, expo.client_id
, case when (conv.set_to_default >= 1 AND expo.set_to_default_card >= 1) then 1
when (coalesce(conv.set_to_default, 0) = 0 AND expo.set_to_default_card >= 1) then 0 else null end as set_to_default_flag
, case when (conv.turn_on_notifications >= 1 AND expo.turn_on_notifications_card >= 1) then 1
when (coalesce(conv.turn_on_notifications, 0) = 0 AND expo.turn_on_notifications_card >= 1) then 0 else null end as turn_on_notifications_flag
, case when (conv.sign_in >= 1 AND expo.sign_in_card >= 1) then 1
when (coalesce(conv.sign_in,0) = 0 AND expo.sign_in_card >= 1) then 0 else null end as sign_in_flag
, case when (conv.set_to_default >= 1 AND expo.set_to_default_card >= 1) OR (conv.turn_on_notifications >= 1 AND expo.turn_on_notifications_card >= 1) OR (conv.sign_in >= 1 AND expo.sign_in_card >= 1)then 1
when (coalesce(conv.set_to_default, 0) = 0 AND coalesce(conv.turn_on_notifications, 0) = 0 AND coalesce(conv.sign_in,0) = 0) AND (set_to_default_card >= 1 OR turn_on_notifications_card >= 1 OR sign_in_card >= 1) then 0 else null end as at_least_1_cta
FROM (
SELECT
client_info.client_id as client_id
, min(DATE(submission_timestamp)) as submission_date
, count(case when ext.value in ("default-browser", "welcome") then DATE(submission_timestamp) END) as set_to_default_card
, count(case when ext.value in ( "notification-permissions", "notificationPermission", "notificationPermissions") then DATE(submission_timestamp) END) as turn_on_notifications_card
, count(case when ext.value in ("sign-to-sync", "signToSync") then DATE(submission_timestamp) END) as sign_in_card
FROM
`mozdata.org_mozilla_ios_firefox.events` tm
CROSS JOIN
UNNEST(events) AS event
CROSS JOIN
UNNEST(event.extra) AS ext
WHERE event.name = "card_view" AND event.category = "onboarding" AND ext.key ="card_type"
AND ext.value in ("default-browser", "welcome", "notification-permissions", "sign-to-sync", "signToSync", "notificationPermission", "notificationPermissions")
-- Ask if any of the CTAs we care about are shown on wallpaper, welcome, pin card
-- if so that will make the logic a bit complex
-- Also ask if the different variation mean the same thing and ask engineers to standardize
AND DATE(submission_timestamp) >= "2023-06-01"
GROUP BY 1
) expo
LEFT JOIN (
SELECT
client_info.client_id as client_id
, count(case when ext.value = "set-default-browser" then DATE(submission_timestamp) END) as set_to_default
, count(case when ext.value = "request-notifications" then DATE(submission_timestamp) END) as turn_on_notifications
, count(case when ext.value = "sync-sign-in" then DATE(submission_timestamp) END) as sign_in
FROM
`mozdata.org_mozilla_ios_firefox.events` tm
CROSS JOIN
UNNEST(events) AS event
CROSS JOIN
UNNEST(event.extra) AS ext
WHERE event.category = "onboarding" AND event.name = "primary_button_tap" AND ext.key ="button_action"
AND ext.value in ("set-default-browser", "request-notifications", "open-default-browser-popup", "sync-sign-in")
-- "open-default-browser-popup" the same as "set-default-browser"??
AND DATE(submission_timestamp) >= "2023-06-01"
GROUP BY 1
) conv
ON expo.client_id = conv.client_id
GROUP BY 1, 2, 3, 4, 5, 6
)"""
experiments_column_type = "none"
[data_sources.appstore_funnel]
from_expression = """(
SELECT *
FROM `mozdata.firefox_ios.app_store_funnel`
)"""
friendly_name = "Appstore Funnel Metrics"
description = "Top of the funnel metrics pulled from appstore api"
submission_date_column = "submission_date"
client_id_column = "NULL"
[data_sources.funnel_retention]
from_expression = """(
SELECT *
FROM `mozdata.firefox_ios.funnel_retention_week_4`
)"""
friendly_name = "iOS Funnel Retention Metrics"
description = "Bottom of the funnel metrics pulled from clients telemetry table"
submission_date_column = "submission_date"
client_id_column = "NULL"
[data_sources.firefox_ios_engagement_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.firefox_ios.engagement`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
description = "Aggregated DAU, WAU, and MAU by different attributes for engagement ratio calculation."
friendly_name = "Firefox iOS Engagement"
client_id_column = "NULL"
[data_sources.firefox_ios_retention_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.firefox_ios.retention`
WHERE is_mobile
)"""
submission_date_column = "metric_date"
description = "Aggregated 4th Week Retention Outcomes of Firefox iOS New and Existing Users."
friendly_name = "Firefox iOS Retention"
client_id_column = "NULL"
[data_sources.firefox_ios_active_users_view]
friendly_name = "Firefox iOS Active Users"
description = "Client-level table that indicates whether a client meets 'active user' criteria on a given submission_date."
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.firefox_ios.active_users`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
client_id_column = "client_id"
deprecated = false

Просмотреть файл

@ -0,0 +1,400 @@
[metrics]
[metrics.baseline_ping_count]
data_source = "baseline"
select_expression = "COUNT(document_id)"
friendly_name = "Baseline pings"
description = "Counts the number of `baseline` pings received from each client."
[metrics.metric_ping_count]
data_source = "metrics"
select_expression = "COUNT(document_id)"
friendly_name = "Metrics pings"
description = "Counts the number of `metrics` pings received from each client."
[metrics.first_run_date]
data_source = "baseline"
select_expression = "MIN(client_info.first_run_date)"
friendly_name = "First run date"
description = "The earliest first-run date reported by each client."
[metrics.active_hours]
select_expression = "COALESCE(SUM(metrics.timespan.glean_baseline_duration.value), 0) / 3600.0"
data_source = "baseline"
friendly_name = "Active Hours"
description = "Total time Firefox was active"
[metrics.days_of_use]
friendly_name = "Days of use"
description = "The number of days in an observation window that clients used the browser."
select_expression = "COUNT(DISTINCT DATE(submission_timestamp))"
data_source = "baseline"
[metrics.daily_active_users]
data_source = "baseline_v2"
select_expression = "COUNT(DISTINCT CASE WHEN LOWER(metadata.isp.name) != 'browserstack' THEN client_info.client_id ELSE NULL END)"
type = "scalar"
friendly_name = "DAU"
description = """
The number of unique clients that we received a baseline ping from each day, excluding
pings originating from BrowserStack. To be comparable to DAU used for KPI tracking,
this metric needs to be aggregated by `submission_date`. If the metric is NOT
aggregated by `submission_date`, the metric is similar to a "days of use" metric. Note
that data retention on `focus_android.baseline` has [historically been only 180 days](https://bugzilla.mozilla.org/show_bug.cgi?id=1828666),
which is shorter than other mobile `baseline` tables. For more details, refer to
[the DAU description in the Mozilla Data Documentation](https://docs.telemetry.mozilla.org/concepts/terminology.html#dau).
For questions, please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
category = "KPI"
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.daily_active_users_v2]
data_source = "focus_android_active_users_aggregates_view"
select_expression = "SUM(dau)"
type = "scalar"
friendly_name = "Focus Android DAU"
description = """
This is the official DAU reporting definition. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
Whenever possible, this is the preferred DAU reporting definition to use for Focus Android.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`,
it is similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.client_level_daily_active_users_v1]
data_source = "baseline_v2"
select_expression = "COUNT(DISTINCT CASE WHEN LOWER(metadata.isp.name) != 'browserstack' THEN client_info.client_id ELSE NULL END)"
type = "scalar"
friendly_name = "Focus Android Client-Level DAU"
description = """
This metric reports DAU values similar (but not necessarily identical)
to the [official DAU reporting definition](https://mozilla.github.io/metric-hub/metrics/focus_android/#daily_active_users_v2).
It's generally preferable to use the official DAU reporting definition when possible; this metric
exists only for cases where reporting `client_id` is required (e.g. for experiments). This metric
needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.client_level_daily_active_users_v2]
data_source = "baseline_v2"
select_expression = """
COUNT(DISTINCT CASE WHEN metrics.timespan.glean_baseline_duration.value > 0
AND LOWER(metadata.isp.name) != 'browserstack'
THEN client_info.client_id
ELSE NULL END)
"""
type = "scalar"
friendly_name = "Focus Android Client-Level DAU"
description = """
This metric reports DAU values similar (but not necessarily identical)
to the [official DAU reporting definition](https://mozilla.github.io/metric-hub/metrics/focus_android/#daily_active_users_v2).
It's generally preferable to use the official DAU reporting definition when possible; this metric
exists only for cases where reporting `client_id` is required (e.g. for experiments). This metric
needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.client_level_daily_active_users_v3]
friendly_name = "Focus Android Client-Level DAU"
data_source = "focus_android_active_users_view"
select_expression = """COUNTIF(is_dau)"""
type = "scalar"
description = """
Client-level DAU. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.ad_clicks]
select_expression = "{{agg_sum('ad_click')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Ad Clicks"
description = """
Counts clicks on ads on search engine result pages with a Mozilla
partner tag.
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.ad_clicks_organic]
friendly_name = "Ad Clicks through organic traffic"
description = """
Counts clicks on ads on search engine result pages that are _not_ tagged with an eligible Mozilla
partner code.
"""
select_expression = "{{agg_sum('ad_click_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads_organic]
friendly_name = "Organic Search With Ads Count"
description = "Total number of Organic Search With Ads Counts"
select_expression = "{{agg_sum('search_with_ads_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.search_count]
friendly_name = "SAP search count"
description = "Number of searches performed through a Search Access Point."
select_expression = "{{agg_sum('search_count')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.search_count_imputed]
friendly_name = "SAP search count (legacy to glean conversion)"
description = "Imputed SAP for converting historical search counts from legacy to glean"
select_expression = "ROUND(SUM(IF(submission_date < '2023-01-01', search_count * 0.49, search_count)))"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_search_count]
data_source = "mobile_search_clients_engines_sources_daily"
select_expression = '{{agg_sum("tagged_sap")}}'
friendly_name = "Tagged SAP searches"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points that were submitted with a partner code
and were potentially revenue-generating.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_follow_on_search_count]
data_source = "mobile_search_clients_engines_sources_daily"
select_expression = '{{agg_sum("tagged_follow_on")}}'
friendly_name = "Tagged follow-on searches"
description = """
Counts the number of follow-on searches with a Mozilla partner tag.
These are additional searches that users performed from a search engine
results page after executing a tagged search through a SAP.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads]
data_source = "mobile_search_clients_engines_sources_daily"
select_expression = '{{agg_sum("search_with_ads")}}'
friendly_name = "Search result pages with ads"
description = """
Counts search result pages served with advertising.
Users may not actually see these ads thanks to e.g. ad-blockers.
Learn more in the
[search analysis documentation](https://mozilla-private.report/search-analysis-docs/book/in_content_searches.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.organic_search_count]
data_source = "mobile_search_clients_engines_sources_daily"
select_expression = '{{agg_sum("organic")}}'
friendly_name = "Organic searches"
description = """
Counts organic searches, which are searches that are _not_ performed
through a Firefox SAP and which are not monetizable.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.engagement_rate_v1]
friendly_name = "Focus Android Engagement Rate"
data_source = "focus_android_engagement_view"
select_expression = "SUM(dau) / SUM(mau)"
type = "scalar"
description = """
The Engagement Rate is calculated as the ratio between DAU and MAU. For each day, we use the single-day DAU number and divide
it by the MAU corresponding to the 28-day period ending on that day. For OKR reporting, we then calculate a
28-day moving average of this number. More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#Engagement-Rate).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.retention_rate_v1]
friendly_name = "Focus Android Retention Rate"
data_source = "focus_android_retention_view"
select_expression = "SUM(retained_week_4) / SUM(active_metric_date)"
type = "scalar"
description = """
The Retention Rate is calculated as the proportion of clients that are active on the 4th week after the metric date.
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.new_profile_retention_rate_v1]
friendly_name = "Focus Android New Proflie Retention Rate"
data_source = "focus_android_retention_view"
select_expression = "SUM(retained_week_4_new_profiles) / SUM(new_profiles_metric_date)"
type = "scalar"
description = """
The New Profile Retention Rate is calculated as the proportion of new profiles that are active on the 4th week after the metric date.
More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#New-Profile-Retention).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[data_sources]
[data_sources.focus_android_active_users_aggregates_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.telemetry.active_users_aggregates`
WHERE app_name = 'Focus Android'
)"""
friendly_name = "Active Users Aggregates"
description = "Active Users Aggregates, filtered on Focus Android"
submission_date_column = "submission_date"
client_id_column = "NULL" # this table doesn't include client_id, and we don't need it for calculating DAU
[data_sources.baseline]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_focus"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.baseline_v2]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
submission_date_column = "submission_date"
experiments_column_type = "glean"
default_dataset = "focus_android"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.events]
from_expression = """(
SELECT
p.* EXCEPT (events),
DATE(p.submission_timestamp) AS submission_date,
event
FROM
`moz-fx-data-shared-prod.{dataset}.events` p
CROSS JOIN
UNNEST(p.events) AS event
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_focus"
friendly_name = "Events"
description = "Events Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.metrics]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.metrics` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_focus"
friendly_name = "Metrics"
description = "Metrics Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.mobile_search_clients_engines_sources_daily]
from_expression = "mozdata.search.mobile_search_clients_engines_sources_daily"
experiments_column_type = "simple"
client_id_column = "client_id"
submission_date_column = "submission_date"
[data_sources.focus_android_engagement_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.focus_android.engagement`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
description = "Aggregated DAU, WAU, and MAU by different attributes for engagement ratio calculation."
friendly_name = "Focus Android Engagement"
client_id_column = "NULL"
[data_sources.focus_android_retention_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.focus_android.retention`
WHERE is_mobile
)"""
submission_date_column = "metric_date"
description = "Aggregated 4th Week Retention Outcomes of Focus Android New and Existing Users."
friendly_name = "Focus Android Retention"
client_id_column = "NULL"
[data_sources.focus_android_active_users_view]
friendly_name = "Focus Android Active Users"
description = "Client-level table that indicates whether a client meets 'active user' criteria on a given submission_date."
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.focus_android.active_users`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
client_id_column = "client_id"
deprecated = false

Просмотреть файл

@ -0,0 +1,407 @@
[metrics]
[metrics.baseline_ping_count]
data_source = "baseline"
select_expression = "COUNT(document_id)"
friendly_name = "Baseline pings"
description = "Counts the number of `baseline` pings received from each client."
[metrics.metric_ping_count]
data_source = "metrics"
select_expression = "COUNT(document_id)"
friendly_name = "Metrics pings"
description = "Counts the number of `metrics` pings received from each client."
[metrics.first_run_date]
data_source = "baseline"
select_expression = "MIN(client_info.first_run_date)"
friendly_name = "First run date"
description = "The earliest first-run date reported by each client."
[metrics.active_hours]
select_expression = "COALESCE(SUM(metrics.timespan.glean_baseline_duration.value), 0) / 3600.0"
data_source = "baseline"
friendly_name = "Active Hours"
description = "Total time Firefox was active"
[metrics.days_of_use]
friendly_name = "Days of use"
description = "The number of days in an observation window that clients used the browser."
select_expression = "COUNT(DISTINCT DATE(submission_timestamp))"
data_source = "baseline"
[metrics.daily_active_users]
data_source = "baseline_v2"
select_expression = "COUNT(DISTINCT CASE WHEN LOWER(metadata.isp.name) != 'browserstack' THEN client_info.client_id ELSE NULL END)"
type = "scalar"
friendly_name = "DAU"
description = """
The number of unique clients that we received a baseline ping from each day, excluding
pings originating from BrowserStack. To be comparable to DAU used for KPI tracking,
this metric needs to be aggregated by `submission_date`. If the metric is NOT
aggregated by `submission_date`, the metric is similar to a "days of use" metric. For more details, refer to
[the DAU description in the Mozilla Data Documentation](https://docs.telemetry.mozilla.org/concepts/terminology.html#dau).
For questions, please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
category = "KPI"
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.daily_active_users_v2]
data_source = "focus_ios_active_users_aggregates_view"
select_expression = "SUM(dau)"
type = "scalar"
friendly_name = "Focus iOS DAU"
description = """
This is the official DAU reporting definition. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
Whenever possible, this is the preferred DAU reporting definition to use for Focus iOS.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`,
it is similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.client_level_daily_active_users_v1]
data_source = "baseline_v2"
select_expression = "COUNT(DISTINCT CASE WHEN LOWER(metadata.isp.name) != 'browserstack' THEN client_info.client_id ELSE NULL END)"
type = "scalar"
friendly_name = "Focus iOS Client-Level DAU"
description = """
This metric reports DAU values similar (but not necessarily identical)
to the [official DAU reporting definition](https://mozilla.github.io/metric-hub/metrics/focus_ios/#daily_active_users_v2).
It's generally preferable to use the official DAU reporting definition when possible; this metric
exists only for cases where reporting `client_id` is required (e.g. for experiments). This metric
needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.client_level_daily_active_users_v2]
data_source = "baseline_v2"
select_expression = """
COUNT(DISTINCT CASE WHEN metrics.timespan.glean_baseline_duration.value > 0
AND LOWER(metadata.isp.name) != 'browserstack'
THEN client_info.client_id
ELSE NULL END)
"""
type = "scalar"
friendly_name = "Focus iOS Client-Level DAU"
description = """
This metric reports DAU values similar (but not necessarily identical)
to the [official DAU reporting definition](https://mozilla.github.io/metric-hub/metrics/focus_ios/#daily_active_users_v2).
It's generally preferable to use the official DAU reporting definition when possible; this metric
exists only for cases where reporting `client_id` is required (e.g. for experiments). This metric
needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
For more information, refer to [the DAU description in Confluence](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric).
For questions please contact bochocki@mozilla.com or firefox-kpi@mozilla.com.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = true
[metrics.client_level_daily_active_users_v3]
friendly_name = "Focus iOS Client-Level DAU"
data_source = "focus_ios_active_users_view"
select_expression = """COUNTIF(is_dau)"""
type = "scalar"
description = """
Client-level DAU. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.ad_clicks]
select_expression = "{{agg_sum('ad_click')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Ad Clicks"
description = """
Counts clicks on ads on search engine result pages with a Mozilla
partner tag.
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.ad_clicks_organic]
friendly_name = "Ad Clicks through organic traffic"
description = """
Counts clicks on ads on search engine result pages that are _not_ tagged with an eligible Mozilla
partner code.
"""
select_expression = "{{agg_sum('ad_click_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads_organic]
friendly_name = "Organic Search With Ads Count"
description = "Total number of Organic Search With Ads Counts"
select_expression = "{{agg_sum('search_with_ads_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.search_count]
friendly_name = "SAP search count"
description = "Number of searches performed through a Search Access Point."
select_expression = "{{agg_sum('search_count')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
# To get more context about how the conversion factors were derived, see
# https://mozilla-hub.atlassian.net/browse/RS-650
[metrics.search_count_imputed]
friendly_name = "SAP search count (legacy to glean conversion)"
description = "Imputed SAP for converting historical search counts from legacy to glean"
select_expression = "ROUND(SUM(IF((submission_date >= '2023-01-01') AND (browser_version_info.major_version < 111), search_count - search_count * 0.4, search_count)))"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_search_count]
friendly_name = "Tagged SAP searches"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points that were submitted with a partner code
and were potentially revenue-generating.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('tagged_sap')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_follow_on_search_count]
friendly_name = "Tagged follow-on searches"
description = """
Counts the number of follow-on searches with a Mozilla partner tag.
These are additional searches that users performed from a search engine
results page after executing a tagged search through a SAP.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('tagged_follow_on')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.organic_search_count]
friendly_name = "Organic searches"
description = """
Counts organic searches, which are searches that are _not_ performed
through a Firefox SAP and which are not monetizable.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads]
friendly_name = "Search result pages with ads (a.k.a. Ad Impressions) both tagged and organic"
description = """
Counts search result pages served with advertising.
Users may not actually see these ads thanks to e.g. ad-blockers.
Learn more in the
[search analysis documentation](https://mozilla-private.report/search-analysis-docs/book/in_content_searches.html).
"""
select_expression = '{{agg_sum("search_with_ads")}}'
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.engagement_rate_v1]
friendly_name = "Focus iOS Engagement Rate"
data_source = "focus_ios_engagement_view"
select_expression = "SUM(dau) / SUM(mau)"
type = "scalar"
description = """
The Engagement Rate is calculated as the ratio between DAU and MAU. For each day, we use the single-day DAU number and divide
it by the MAU corresponding to the 28-day period ending on that day. For OKR reporting, we then calculate a
28-day moving average of this number. More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#Engagement-Rate).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.retention_rate_v1]
friendly_name = "Focus iOS Retention Rate"
data_source = "focus_ios_retention_view"
select_expression = "SUM(retained_week_4) / SUM(active_metric_date)"
type = "scalar"
description = """
The Retention Rate is calculated as the proportion of clients that are active on the 4th week after the metric date.
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.new_profile_retention_rate_v1]
friendly_name = "Focus iOS New Proflie Retention Rate"
data_source = "focus_ios_retention_view"
select_expression = "SUM(retained_week_4_new_profiles) / SUM(new_profiles_metric_date)"
type = "scalar"
description = """
The New Profile Retention Rate is calculated as the proportion of new profiles that are active on the 4th week after the metric date.
More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#New-Profile-Retention).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[data_sources]
[data_sources.focus_ios_active_users_aggregates_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.telemetry.active_users_aggregates`
WHERE app_name = 'Focus iOS'
)"""
friendly_name = "Active Users Aggregates"
description = "Active Users Aggregates, filtered on Focus iOS"
submission_date_column = "submission_date"
client_id_column = "NULL" # this table doesn't include client_id, and we don't need it for calculating DAU
[data_sources.baseline]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_focus"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.baseline_v2]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
submission_date_column = "submission_date"
experiments_column_type = "glean"
default_dataset = "focus_ios"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.events]
from_expression = """(
SELECT
p.* EXCEPT (events),
DATE(p.submission_timestamp) AS submission_date,
event
FROM
`moz-fx-data-shared-prod.{dataset}.events` p
CROSS JOIN
UNNEST(p.events) AS event
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_focus"
friendly_name = "Events"
description = "Events Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.metrics]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.metrics` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_focus"
friendly_name = "Metrics"
description = "Metrics Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.mobile_search_clients_engines_sources_daily]
from_expression = """(
SELECT *
FROM `mozdata.search.mobile_search_clients_engines_sources_daily`
WHERE normalized_app_name_os = 'Focus iOS'
)"""
experiments_column_type = "simple"
client_id_column = "client_id"
submission_date_column = "submission_date"
[data_sources.focus_ios_engagement_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.focus_ios.engagement`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
description = "Aggregated DAU, WAU, and MAU by different attributes for engagement ratio calculation."
friendly_name = "Focus iOS Engagement"
client_id_column = "NULL"
[data_sources.focus_ios_retention_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.focus_ios.retention`
WHERE is_mobile
)"""
submission_date_column = "metric_date"
description = "Aggregated 4th Week Retention Outcomes of Focus iOS New and Existing Users."
friendly_name = "Focus iOS Retention"
client_id_column = "NULL"
[data_sources.focus_ios_active_users_view]
friendly_name = "Focus iOS Active Users"
description = "Client-level table that indicates whether a client meets 'active user' criteria on a given submission_date."
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.focus_ios.active_users`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
client_id_column = "client_id"
deprecated = false

Просмотреть файл

@ -0,0 +1,32 @@
[functions]
[functions.agg_sum]
definition = "COALESCE(SUM({select_expr}), 0)"
friendly_name = "Sum"
description = "Calculates the sum of the select expression"
[functions.agg_any]
definition = "COALESCE(LOGICAL_OR({select_expr}), FALSE)"
friendly_name = "Any"
description = "Returns true if any of the boolean selected values are TRUE, otherwise FALSE"
[functions.agg_histogram_mean]
definition = """
SAFE_DIVIDE(
SUM(CAST(JSON_EXTRACT_SCALAR({select_expr}, "$.sum") AS int64)),
SUM((SELECT SUM(value) FROM UNNEST(mozfun.hist.extract({select_expr}).values)))
)
"""
friendly_name = "Histogram Mean"
description = "Computes the mean of the histogram"
[functions.agg_hist_zero_fract]
definition = """
SAFE_DIVIDE(
SUM(mozfun.map.get_key(mozfun.hist.extract({select_expr}).values,0)),
SUM(mozfun.hist.threshold_count({select_expr},1))
)
"""
friendly_name = "Histogram Zero Fraction"
description = "Computes the fraction of entries in a Histogram which are zero"

Просмотреть файл

@ -0,0 +1,280 @@
[metrics]
[metrics.baseline_ping_count]
data_source = "baseline"
select_expression = "COUNT(document_id)"
friendly_name = "Baseline pings"
description = "Counts the number of `baseline` pings received from each client."
[metrics.metric_ping_count]
data_source = "metrics"
select_expression = "COUNT(document_id)"
friendly_name = "Metrics pings"
description = "Counts the number of `metrics` pings received from each client."
[metrics.first_run_date]
data_source = "baseline"
select_expression = "MIN(client_info.first_run_date)"
friendly_name = "First run date"
description = "The earliest first-run date reported by each client."
[metrics.active_hours]
select_expression = "COALESCE(SUM(metrics.timespan.glean_baseline_duration.value), 0) / 3600.0"
data_source = "baseline"
friendly_name = "Active Hours"
description = "Total time Firefox was active"
[metrics.days_of_use]
friendly_name = "Days of use"
description = "The number of days in an observation window that clients used the browser."
select_expression = "COUNT(DISTINCT DATE(submission_timestamp))"
data_source = "baseline"
[metrics.ad_clicks]
select_expression = "{{agg_sum('ad_click')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Ad Clicks"
description = """
Counts clicks on ads on search engine result pages with a Mozilla
partner tag.
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.ad_clicks_organic]
friendly_name = "Ad Clicks through organic traffic"
description = """
Counts clicks on ads on search engine result pages that are _not_ tagged with an eligible Mozilla
partner code.
"""
select_expression = "{{agg_sum('ad_click_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads_organic]
friendly_name = "Organic Search With Ads Count"
description = "Total number of Organic Search With Ads Counts"
select_expression = "{{agg_sum('search_with_ads_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.search_count]
friendly_name = "SAP search count"
description = "Number of searches performed through a Search Access Point."
select_expression = "{{agg_sum('search_count')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_search_count]
data_source = "mobile_search_clients_engines_sources_daily"
select_expression = '{{agg_sum("tagged_sap")}}'
friendly_name = "Tagged SAP searches"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points that were submitted with a partner code
and were potentially revenue-generating.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_follow_on_search_count]
data_source = "mobile_search_clients_engines_sources_daily"
select_expression = '{{agg_sum("tagged_follow_on")}}'
friendly_name = "Tagged follow-on searches"
description = """
Counts the number of follow-on searches with a Mozilla partner tag.
These are additional searches that users performed from a search engine
results page after executing a tagged search through a SAP.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads]
data_source = "mobile_search_clients_engines_sources_daily"
select_expression = '{{agg_sum("search_with_ads")}}'
friendly_name = "Search result pages with ads"
description = """
Counts search result pages served with advertising.
Users may not actually see these ads thanks to e.g. ad-blockers.
Learn more in the
[search analysis documentation](https://mozilla-private.report/search-analysis-docs/book/in_content_searches.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.organic_search_count]
data_source = "mobile_search_clients_engines_sources_daily"
select_expression = '{{agg_sum("organic")}}'
friendly_name = "Organic searches"
description = """
Counts organic searches, which are searches that are _not_ performed
through a Firefox SAP and which are not monetizable.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.engagement_rate_v1]
friendly_name = "Klar Android Engagement Rate"
data_source = "klar_android_engagement_view"
select_expression = "SUM(dau) / SUM(mau)"
type = "scalar"
description = """
The Engagement Rate is calculated as the ratio between DAU and MAU. For each day, we use the single-day DAU number and divide
it by the MAU corresponding to the 28-day period ending on that day. For OKR reporting, we then calculate a
28-day moving average of this number. More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#Engagement-Rate).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.retention_rate_v1]
friendly_name = "Klar Android Retention Rate"
data_source = "klar_android_retention_view"
select_expression = "SUM(retained_week_4) / SUM(active_metric_date)"
type = "scalar"
description = """
The Retention Rate is calculated as the proportion of clients that are active on the 4th week after the metric date.
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.new_profile_retention_rate_v1]
friendly_name = "Klar Android New Proflie Retention Rate"
data_source = "klar_android_retention_view"
select_expression = "SUM(retained_week_4_new_profiles) / SUM(new_profiles_metric_date)"
type = "scalar"
description = """
The New Profile Retention Rate is calculated as the proportion of new profiles that are active on the 4th week after the metric date.
More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#New-Profile-Retention).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.client_level_daily_active_users_v1]
friendly_name = "Klar Android Client-Level DAU"
data_source = "klar_android_active_users_view"
select_expression = """COUNTIF(is_dau)"""
type = "scalar"
description = """
Client-level DAU. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[data_sources]
[data_sources.baseline]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_klar"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.events]
from_expression = """(
SELECT
p.* EXCEPT (events),
DATE(p.submission_timestamp) AS submission_date,
event
FROM
`moz-fx-data-shared-prod.{dataset}.events` p
CROSS JOIN
UNNEST(p.events) AS event
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_klar"
friendly_name = "Events"
description = "Events Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.metrics]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.metrics` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_klar"
friendly_name = "Metrics"
description = "Metrics Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.mobile_search_clients_engines_sources_daily]
from_expression = "mozdata.search.mobile_search_clients_engines_sources_daily"
experiments_column_type = "simple"
client_id_column = "client_id"
submission_date_column = "submission_date"
[data_sources.klar_android_engagement_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.klar_android.engagement`
WHERE app_name = "Klar Android"
)"""
submission_date_column = "submission_date"
description = "Aggregated DAU, WAU, and MAU by different attributes for engagement ratio calculation."
friendly_name = "Klar Android Engagement"
client_id_column = "NULL"
[data_sources.klar_android_retention_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.klar_android.retention`
WHERE app_name = "Klar Android"
)"""
submission_date_column = "metric_date"
description = "Aggregated 4th Week Retention Outcomes of Klar Android New and Existing Users."
friendly_name = "Klar Android Retention"
client_id_column = "NULL"
[data_sources.klar_android_active_users_view]
friendly_name = "Klar Android Active Users"
description = "Client-level table that indicates whether a client meets 'active user' criteria on a given submission_date."
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.klar_android.active_users`
WHERE app_name = "Klar Android"
)"""
submission_date_column = "submission_date"
client_id_column = "client_id"
deprecated = false

Просмотреть файл

@ -0,0 +1,284 @@
[metrics]
[metrics.baseline_ping_count]
data_source = "baseline"
select_expression = "COUNT(document_id)"
friendly_name = "Baseline pings"
description = "Counts the number of `baseline` pings received from each client."
[metrics.metric_ping_count]
data_source = "metrics"
select_expression = "COUNT(document_id)"
friendly_name = "Metrics pings"
description = "Counts the number of `metrics` pings received from each client."
[metrics.first_run_date]
data_source = "baseline"
select_expression = "MIN(client_info.first_run_date)"
friendly_name = "First run date"
description = "The earliest first-run date reported by each client."
[metrics.active_hours]
select_expression = "COALESCE(SUM(metrics.timespan.glean_baseline_duration.value), 0) / 3600.0"
data_source = "baseline"
friendly_name = "Active Hours"
description = "Total time Firefox was active"
[metrics.days_of_use]
friendly_name = "Days of use"
description = "The number of days in an observation window that clients used the browser."
select_expression = "COUNT(DISTINCT DATE(submission_timestamp))"
data_source = "baseline"
[metrics.ad_clicks]
select_expression = "{{agg_sum('ad_click')}}"
data_source = "mobile_search_clients_engines_sources_daily"
friendly_name = "Ad Clicks"
description = """
Counts clicks on ads on search engine result pages with a Mozilla
partner tag.
"""
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.ad_clicks_organic]
friendly_name = "Ad Clicks through organic traffic"
description = """
Counts clicks on ads on search engine result pages that are _not_ tagged with an eligible Mozilla
partner code.
"""
select_expression = "{{agg_sum('ad_click_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads_organic]
friendly_name = "Organic Search With Ads Count"
description = "Total number of Organic Search With Ads Counts"
select_expression = "{{agg_sum('search_with_ads_organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.search_count]
friendly_name = "SAP search count"
description = "Number of searches performed through a Search Access Point."
select_expression = "{{agg_sum('search_count')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_search_count]
friendly_name = "Tagged SAP searches"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points that were submitted with a partner code
and were potentially revenue-generating.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('tagged_sap')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.tagged_follow_on_search_count]
friendly_name = "Tagged follow-on searches"
description = """
Counts the number of follow-on searches with a Mozilla partner tag.
These are additional searches that users performed from a search engine
results page after executing a tagged search through a SAP.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('tagged_follow_on')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.organic_search_count]
friendly_name = "Organic searches"
description = """
Counts organic searches, which are searches that are _not_ performed
through a Firefox SAP and which are not monetizable.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
select_expression = "{{agg_sum('organic')}}"
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.searches_with_ads]
friendly_name = "Search result pages with ads (a.k.a. Ad Impressions) both tagged and organic"
description = """
Counts search result pages served with advertising.
Users may not actually see these ads thanks to e.g. ad-blockers.
Learn more in the
[search analysis documentation](https://mozilla-private.report/search-analysis-docs/book/in_content_searches.html).
"""
select_expression = '{{agg_sum("search_with_ads")}}'
data_source = "mobile_search_clients_engines_sources_daily"
category = "search"
type = "scalar"
owner = "xluo-all@mozilla.com"
[metrics.engagement_rate_v1]
friendly_name = "Klar iOS Engagement Rate"
data_source = "klar_ios_engagement_view"
select_expression = "SUM(dau) / SUM(mau)"
type = "scalar"
description = """
The Engagement Rate is calculated as the ratio between DAU and MAU. For each day, we use the single-day DAU number and divide
it by the MAU corresponding to the 28-day period ending on that day. For OKR reporting, we then calculate a
28-day moving average of this number. More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#Engagement-Rate).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.retention_rate_v1]
friendly_name = "Klar iOS Retention Rate"
data_source = "klar_ios_retention_view"
select_expression = "SUM(retained_week_4) / SUM(active_metric_date)"
type = "scalar"
description = """
The Retention Rate is calculated as the proportion of clients that are active on the 4th week after the metric date.
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.new_profile_retention_rate_v1]
friendly_name = "Klar iOS New Proflie Retention Rate"
data_source = "klar_ios_retention_view"
select_expression = "SUM(retained_week_4_new_profiles) / SUM(new_profiles_metric_date)"
type = "scalar"
description = """
The New Profile Retention Rate is calculated as the proportion of new profiles that are active on the 4th week after the metric date.
More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#New-Profile-Retention).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[metrics.client_level_daily_active_users_v1]
friendly_name = "Klar iOS Client-Level DAU"
data_source = "klar_ios_active_users_view"
select_expression = """COUNTIF(is_dau)"""
type = "scalar"
description = """
Client-level DAU. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`, it is
similar to a "days of use" metric, and not DAU.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
[data_sources]
[data_sources.baseline]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.baseline` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_klar"
friendly_name = "Baseline"
description = "Baseline Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.events]
from_expression = """(
SELECT
p.* EXCEPT (events),
DATE(p.submission_timestamp) AS submission_date,
event
FROM
`moz-fx-data-shared-prod.{dataset}.events` p
CROSS JOIN
UNNEST(p.events) AS event
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_klar"
friendly_name = "Events"
description = "Events Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.metrics]
from_expression = """(
SELECT
p.*,
DATE(p.submission_timestamp) AS submission_date
FROM `moz-fx-data-shared-prod.{dataset}.metrics` p
)"""
client_id_column = "client_info.client_id"
experiments_column_type = "glean"
default_dataset = "org_mozilla_ios_klar"
friendly_name = "Metrics"
description = "Metrics Ping"
build_id_column = "REPLACE(CAST(DATE(mozfun.norm.fenix_build_to_datetime(client_info.app_build)) AS STRING), '-', '')"
[data_sources.mobile_search_clients_engines_sources_daily]
from_expression = """(
SELECT *
FROM `mozdata.search.mobile_search_clients_engines_sources_daily`
WHERE normalized_app_name_os = 'Klar iOS'
)"""
experiments_column_type = "simple"
client_id_column = "client_id"
submission_date_column = "submission_date"
[data_sources.klar_ios_engagement_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.klar_ios.engagement`
WHERE app_name = "Klar iOS"
)"""
submission_date_column = "submission_date"
description = "Aggregated DAU, WAU, and MAU by different attributes for engagement ratio calculation."
friendly_name = "Klar iOS Engagement"
client_id_column = "NULL"
[data_sources.klar_ios_retention_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.klar_ios.retention`
WHERE app_name = "Klar iOS"
)"""
submission_date_column = "metric_date"
description = "Aggregated 4th Week Retention Outcomes of Klar iOS New and Existing Users."
friendly_name = "Klar iOS Retention"
client_id_column = "NULL"
[data_sources.klar_ios_active_users_view]
friendly_name = "Klar iOS Active Users"
description = "Client-level table that indicates whether a client meets 'active user' criteria on a given submission_date."
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.klar_ios.active_users`
WHERE app_name = "Klar iOS"
)"""
submission_date_column = "submission_date"
client_id_column = "client_id"
deprecated = false

Просмотреть файл

@ -0,0 +1,33 @@
[metrics]
[metrics.monitor_pageviews_v1]
data_source = "monitor_events_v1"
select_expression = """
COUNTIF(event.category = 'page' AND event.name = 'view')
"""
type = "scalar"
friendly_name = "Monitor Page Views"
description = """
This is a metric intended to test the functionality of Cirrus within Monitor.
It simply sums the page view events for Monitor.
"""
owner = ["mwilliams@mozilla.com"]
deprecated = false
[data_sources]
[data_sources.monitor_events_v1]
from_expression = """(
SELECT
DATE(submission_timestamp) AS submission_date,
e.* EXCEPT (events),
mozfun.map.get_key(event.extra, 'user_id') as client_id,
event
FROM
`moz-fx-data-shared-prod.monitor_frontend.events` e
CROSS JOIN
UNNEST(e.events) AS event
)"""
experiments_column_type = "glean"
friendly_name = "Monitor Events"
description = "Monitor Events"

Просмотреть файл

@ -0,0 +1,194 @@
[metrics]
[metrics.mobile_daily_active_users_v1]
data_source = "mobile_active_users_aggregates_view"
select_expression = "SUM(dau)"
type = "scalar"
friendly_name = "Mobile DAU"
description = """
This is the official DAU reporting definition. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
Whenever possible, this is the preferred DAU reporting definition to use for Mobile products.
This metric needs to be aggregated by `submission_date`. If it is not aggregated by `submission_date`,
it is similar to a "days of use" metric, and not DAU.
"""
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
level = "silver"
[metrics.mobile_dau_kpi_v1]
data_source = "mobile_active_users_aggregates_view"
select_expression = "SUM(IF(FORMAT_DATE('%m-%d', submission_date) BETWEEN '11-18' AND '12-15', dau, 0)) / 28"
type = "scalar"
friendly_name = "Mobile DAU KPI"
description = """
The average [Mobile DAU](https://mozilla.acryl.io/glossaryTerm/urn:li:glossaryTerm:Metric%20Hub.multi_product.mobile_daily_active_users_v1/Documentation?is_lineage_mode=false)
in the 28-day period ending on December 15th. This is the official Mobile DAU KPI reporting definition. The logic is
[detailed on the Confluence DAU page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/314704478/Daily+Active+Users+DAU+Metric)
and is automatically cross-checked, actively monitored, and change controlled.
To reconstruct the annual Mobile DAU KPI, this metric needs to be aggregated by
`EXTRACT(YEAR FROM submission_date)`.
"""
category = "KPI"
owner = ["bochocki@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
level = "silver"
[metrics.mobile_engagement_rate_v1]
friendly_name = "Mobile Engagement Rate"
data_source = "mobile_engagement_view"
select_expression = "SUM(dau) / SUM(mau)"
type = "scalar"
description = """
The Engagement Rate is calculated as the ratio between DAU and MAU. For each day, we use the single-day DAU number and divide
it by the MAU corresponding to the 28-day period ending on that day. For OKR reporting, we then calculate a
28-day moving average of this number. More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#Engagement-Rate).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
level = "bronze"
[metrics.mobile_retention_rate_v1]
friendly_name = "Mobile Retention Rate"
data_source = "mobile_retention_view"
select_expression = "SUM(retained_week_4) / SUM(active_metric_date)"
type = "scalar"
description = """
The Retention Rate is calculated as the proportion of clients that are active on the 4th week after the metric date.
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
level = "bronze"
[metrics.mobile_new_profile_retention_rate_v1]
friendly_name = "Mobile New Proflie Retention Rate"
data_source = "mobile_retention_view"
select_expression = "SUM(retained_week_4_new_profiles) / SUM(new_profiles_metric_date)"
type = "scalar"
description = """
The New Profile Retention Rate is calculated as the proportion of new profiles that are active on the 4th week after the metric date.
More information is provided on the
[New Profiles, Retention and Engagement Rate Confluence Page](https://mozilla-hub.atlassian.net/wiki/spaces/DATA/pages/814481685/Firefox+New+Profiles+Retention+and+Engagement#New-Profile-Retention).
"""
owner = ["vsabino@mozilla.com", "firefox-kpi@mozilla.com"]
deprecated = false
level = "bronze"
##### search revenue forecasting metrics
[metrics.search_forecasting_daily_active_users]
select_expression = '{{agg_sum("dau")}}'
data_source = "search_revenue_levers_daily"
friendly_name = "Daily Active Users"
description = """
Counts the number of daily active users (DAU) for search revenue forecasting purposes.
"""
category = "search"
type = "scalar"
[metrics.search_forecasting_daily_active_users_w_google_default]
select_expression = '{{agg_sum("dau_w_engine_as_default")}}'
data_source = "search_revenue_levers_daily"
friendly_name = "Daily Active Users with Google as Default"
description = """
Counts the number of daily active users (DAU) with Google as default search engine for search revenue forecasting purposes.
"""
category = "search"
type = "scalar"
[metrics.search_forecasting_daily_active_searchers_w_google_default]
data_source = "search_revenue_levers_daily"
select_expression = '{{agg_sum("dau_engaged_w_sap")}}'
friendly_name = "Daily Active Users who Search with Google as Default"
description = """
Counts the number of daily active users (DAU) with Google as default search engine who also conduct a search for search revenue forecasting purposes.
"""
category = "search"
type = "scalar"
[metrics.search_forecasting_search_count]
data_source = "search_revenue_levers_daily"
select_expression = '{{agg_sum("sap")}}'
friendly_name = "SAP search volume"
description = """
Counts the number of searches a user performed through Firefox's
Search Access Points.
Learn more in the
[search data documentation](https://docs.telemetry.mozilla.org/datasets/search.html).
"""
category = "search"
type = "scalar"
[metrics.search_forecasting_ad_clicks]
data_source = "search_revenue_levers_daily"
select_expression = '{{agg_sum("ad_click")}}'
friendly_name = "Ad click volume"
description = """
Counts clicks on ads on search engine result pages with a Mozilla
partner tag.
"""
category = "search"
type = "scalar"
[metrics.search_forecasting_revenue_per_ad_click]
data_source = "search_revenue_levers_monthly"
select_expression = "SUM(revenue)/ SUM(ad_click)"
friendly_name = "Revenue per Ad Click"
description = """
Revenue paid to Mozilla per Ad Click.
"""
category = "search"
type = "scalar"
######
[data_sources]
[data_sources.mobile_active_users_aggregates_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.telemetry.active_users_aggregates`
WHERE app_name IN ('Fenix', 'Firefox iOS', 'Focus Android', 'Focus iOS')
)"""
friendly_name = "Active Users Aggregates"
description = "Active Users Aggregates, filtered on the Mobile product group"
submission_date_column = "submission_date"
client_id_column = "NULL" # this table doesn't include client_id, and we don't need it for calculating DAU
[data_sources.search_revenue_levers_daily]
from_expression = "mozdata.search.search_revenue_levers_daily"
submission_date_column = "submission_date"
friendly_name = "Search Revenue Levers Daily"
description = "Search Revenue Levers Daily"
client_id_column = "NULL" # aggregated by submission_date, partner, device, channel, country
[data_sources.search_revenue_levers_monthly]
from_expression = "mozdata.revenue.search_revenue_levers_monthly"
submission_date_column = "submission_month"
friendly_name = "Search Revenue Levers Monthly"
description = "Search Revenue Levers Monthly"
client_id_column = "NULL" # aggregated by submission_month, partner, device, country
[data_sources.mobile_engagement_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.telemetry.mobile_engagement`
WHERE is_mobile
)"""
submission_date_column = "submission_date"
description = "Aggregated DAU, WAU, and MAU by different attributes for engagement ratio calculation."
friendly_name = "Mobile Engagement"
client_id_column = "NULL"
[data_sources.mobile_retention_view]
from_expression = """(
SELECT *
FROM `moz-fx-data-shared-prod.telemetry.mobile_retention`
WHERE is_mobile
)"""
submission_date_column = "metric_date"
description = "Aggregated 4th Week Retention Outcomes of Mobile New and Existing Users."
friendly_name = "Mobile Retention"
client_id_column = "NULL"

Просмотреть файл

@ -0,0 +1,16 @@
# Definitions
This directory contains metric, data source and segment definitions that can be referenced from other configuration files without having to be redefined. Configuration files in this directory need to be named after the platform the definitions target.
Changes to these configurations require approval on a pull request.
Once merged, live experiments will get rerun so the new configurations can get applied. Experiments that have been completed in the past **will not be rerun automatically**, manual reruns need to be triggered if necessary.
Avoid making changes to existing metrics, as results might become inconsistent with experiment analysis results computed in the past.
The `functions.toml` configuration file contains definitions of functions a select expression can be passed into. These functions can be called as part of select expressions. For example:
```toml
[metrics.searches_with_ads]
data_source = "search_clients_engines_sources_daily"
select_expression = '{{agg_sum("search_with_ads")}}'
```

Просмотреть файл

@ -0,0 +1,51 @@
[metrics]
[metrics.uri_count.statistics.bootstrap_mean]
[metrics.uri_count.statistics.deciles]
[metrics.user_reports_site_issue_count.statistics.bootstrap_mean]
[metrics.user_reports_site_issue_count.statistics.deciles]
[metrics.user_reload_count.statistics.bootstrap_mean]
[metrics.user_reload_count.statistics.deciles]
[metrics.baseline_ping_count.statistics.bootstrap_mean]
[metrics.baseline_ping_count.statistics.deciles]
[metrics.metric_ping_count.statistics.bootstrap_mean]
[metrics.metric_ping_count.statistics.deciles]
[metrics.first_run_date.statistics.count]
[metrics.active_hours.statistics.bootstrap_mean]
[metrics.active_hours.statistics.deciles]
[metrics.days_of_use.statistics.bootstrap_mean]
drop_highest = 0
[metrics.days_of_use.statistics.deciles]
[metrics.days_of_use.statistics.empirical_cdf]
[metrics.ad_clicks.statistics.bootstrap_mean]
[metrics.ad_clicks.statistics.deciles]
[metrics.tagged_sap_searches.statistics.bootstrap_mean]
[metrics.tagged_sap_searches.statistics.deciles]
[metrics.search_count.statistics.bootstrap_mean]
[metrics.search_count.statistics.deciles]
[metrics.turn_on_notifications_onboarding.statistics.binomial]
[metrics.set_to_default_onboarding.statistics.binomial]
[metrics.sign_in_onboarding.statistics.binomial]
[metrics.at_least_1_cta_onboarding.statistics.binomial]

Просмотреть файл

@ -0,0 +1,87 @@
[metrics]
[metrics.active_hours.statistics.bootstrap_mean]
[metrics.active_hours.statistics.deciles]
[metrics.uri_count.statistics.bootstrap_mean]
[metrics.uri_count.statistics.deciles]
[metrics.search_count.statistics.bootstrap_mean]
[metrics.search_count.statistics.deciles]
[metrics.tagged_search_count.statistics.bootstrap_mean]
[metrics.tagged_search_count.statistics.deciles]
[metrics.tagged_follow_on_search_count.statistics.bootstrap_mean]
[metrics.tagged_follow_on_search_count.statistics.deciles]
[metrics.ad_clicks.statistics.bootstrap_mean]
[metrics.ad_clicks.statistics.deciles]
[metrics.searches_with_ads.statistics.bootstrap_mean]
[metrics.searches_with_ads.statistics.deciles]
[metrics.organic_search_count.statistics.bootstrap_mean]
[metrics.organic_search_count.statistics.deciles]
[metrics.unenroll.statistics.binomial]
[metrics.view_about_logins.statistics.bootstrap_mean]
[metrics.view_about_logins.statistics.deciles]
[metrics.view_about_protections.statistics.bootstrap_mean]
[metrics.view_about_protections.statistics.deciles]
[metrics.connect_fxa.statistics.bootstrap_mean]
[metrics.connect_fxa.statistics.deciles]
[metrics.pocket_rec_clicks.statistics.bootstrap_mean]
[metrics.pocket_spoc_clicks.statistics.bootstrap_mean]
[metrics.days_of_use.statistics.bootstrap_mean]
drop_highest = 0
[metrics.days_of_use.statistics.deciles]
[metrics.days_of_use.statistics.empirical_cdf]
[metrics.qualified_cumulative_days_of_use.statistics.bootstrap_mean]
[metrics.qualified_cumulative_days_of_use.statistics.deciles]
[metrics.disable_pocket_clicks.statistics.bootstrap_mean]
[metrics.disable_pocket_spocs_clicks.statistics.bootstrap_mean]
[metrics.imported_bookmarks.statistics.binomial]
[metrics.imported_bookmarks_count.statistics.bootstrap_mean]
pre_treatments = ["remove_nulls"]
[metrics.imported_logins.statistics.binomial]
[metrics.imported_logins_count.statistics.bootstrap_mean]
pre_treatments = ["remove_nulls"]
[metrics.imported_history.statistics.binomial]
[metrics.imported_history_count.statistics.bootstrap_mean]
pre_treatments = ["remove_nulls"]
[metrics.fxa_signed_in.statistics.binomial]
[metrics.separate_search_engine.statistics.binomial]

Просмотреть файл

@ -0,0 +1,30 @@
[metrics]
[metrics.baseline_ping_count.statistics.bootstrap_mean]
[metrics.baseline_ping_count.statistics.deciles]
[metrics.metric_ping_count.statistics.bootstrap_mean]
[metrics.metric_ping_count.statistics.deciles]
[metrics.first_run_date.statistics.count]
[metrics.active_hours.statistics.bootstrap_mean]
[metrics.active_hours.statistics.deciles]
[metrics.days_of_use.statistics.bootstrap_mean]
drop_highest = 0
[metrics.days_of_use.statistics.deciles]
[metrics.days_of_use.statistics.empirical_cdf]
[metrics.ad_clicks.statistics.bootstrap_mean]
[metrics.ad_clicks.statistics.deciles]
[metrics.search_count.statistics.bootstrap_mean]
[metrics.search_count.statistics.deciles]

Просмотреть файл

@ -0,0 +1,50 @@
[metrics]
[metrics.baseline_ping_count.statistics.bootstrap_mean]
[metrics.baseline_ping_count.statistics.deciles]
[metrics.metric_ping_count.statistics.bootstrap_mean]
[metrics.metric_ping_count.statistics.deciles]
[metrics.first_run_date.statistics.count]
[metrics.active_hours.statistics.bootstrap_mean]
[metrics.active_hours.statistics.deciles]
[metrics.days_of_use.statistics.bootstrap_mean]
drop_highest = 0
[metrics.days_of_use.statistics.deciles]
[metrics.days_of_use.statistics.empirical_cdf]
[metrics.ad_clicks.statistics.bootstrap_mean]
[metrics.ad_clicks.statistics.deciles]
[metrics.search_count.statistics.bootstrap_mean]
[metrics.search_count.statistics.deciles]
[metrics.ad_clicks_organic.statistics.bootstrap_mean]
[metrics.ad_clicks_organic.statistics.deciles]
[metrics.tagged_search_count.statistics.bootstrap_mean]
[metrics.tagged_search_count.statistics.deciles]
[metrics.tagged_follow_on_search_count.statistics.bootstrap_mean]
[metrics.tagged_follow_on_search_count.statistics.deciles]
[metrics.searches_with_ads.statistics.bootstrap_mean]
[metrics.searches_with_ads.statistics.deciles]
[metrics.organic_search_count.statistics.bootstrap_mean]
[metrics.organic_search_count.statistics.deciles]

Просмотреть файл

@ -0,0 +1,30 @@
[metrics]
[metrics.baseline_ping_count.statistics.bootstrap_mean]
[metrics.baseline_ping_count.statistics.deciles]
[metrics.metric_ping_count.statistics.bootstrap_mean]
[metrics.metric_ping_count.statistics.deciles]
[metrics.first_run_date.statistics.count]
[metrics.active_hours.statistics.bootstrap_mean]
[metrics.active_hours.statistics.deciles]
[metrics.days_of_use.statistics.bootstrap_mean]
drop_highest = 0
[metrics.days_of_use.statistics.deciles]
[metrics.days_of_use.statistics.empirical_cdf]
[metrics.ad_clicks.statistics.bootstrap_mean]
[metrics.ad_clicks.statistics.deciles]
[metrics.search_count.statistics.bootstrap_mean]
[metrics.search_count.statistics.deciles]

Просмотреть файл

@ -0,0 +1,15 @@
[functions]
[functions.agg_sum]
definition = "COALESCE(SUM({select_expr}), 0)"
[functions.agg_any]
definition = "COALESCE(LOGICAL_OR({select_expr}), FALSE)"
[functions.agg_histogram_mean]
definition = """
SAFE_DIVIDE(
SUM(CAST(JSON_EXTRACT_SCALAR({select_expr}, "$.sum") AS int64)),
SUM((SELECT SUM(value) FROM UNNEST(mozfun.hist.extract({select_expr}).values)))
)
"""

Просмотреть файл

@ -0,0 +1,29 @@
[metrics]
[metrics.baseline_ping_count.statistics.bootstrap_mean]
[metrics.baseline_ping_count.statistics.deciles]
[metrics.metric_ping_count.statistics.bootstrap_mean]
[metrics.metric_ping_count.statistics.deciles]
[metrics.first_run_date.statistics.count]
[metrics.active_hours.statistics.bootstrap_mean]
[metrics.active_hours.statistics.deciles]
[metrics.days_of_use.statistics.bootstrap_mean]
drop_highest = 0
[metrics.days_of_use.statistics.deciles]
[metrics.days_of_use.statistics.empirical_cdf]
[metrics.ad_clicks.statistics.bootstrap_mean]
[metrics.ad_clicks.statistics.deciles]
[metrics.search_count.statistics.bootstrap_mean]
[metrics.search_count.statistics.deciles]

Просмотреть файл

@ -0,0 +1,30 @@
[metrics]
[metrics.baseline_ping_count.statistics.bootstrap_mean]
[metrics.baseline_ping_count.statistics.deciles]
[metrics.metric_ping_count.statistics.bootstrap_mean]
[metrics.metric_ping_count.statistics.deciles]
[metrics.first_run_date.statistics.count]
[metrics.active_hours.statistics.bootstrap_mean]
[metrics.active_hours.statistics.deciles]
[metrics.days_of_use.statistics.bootstrap_mean]
drop_highest = 0
[metrics.days_of_use.statistics.deciles]
[metrics.days_of_use.statistics.empirical_cdf]
[metrics.ad_clicks.statistics.bootstrap_mean]
[metrics.ad_clicks.statistics.deciles]
[metrics.search_count.statistics.bootstrap_mean]
[metrics.search_count.statistics.deciles]

Просмотреть файл

@ -0,0 +1,6 @@
[metrics]
[metrics.monitor_pageviews_v1.statistics]
bootstrap_mean = {}
deciles = {}
empirical_cdf = {}

Просмотреть файл

@ -0,0 +1,21 @@
from pathlib import Path
from django.test import override_settings
mock_valid_segments = override_settings(
METRIC_HUB_SEGMENTS_PATH_JETSTREAM=(
Path(__file__).parent.absolute() / "fixtures" / "valid_segments_jetstream"
),
METRIC_HUB_SEGMENTS_PATH_DEFAULT=(
Path(__file__).parent.absolute() / "fixtures" / "valid_segments_default"
),
)
mock_invalid_segments = override_settings(
METRIC_HUB_SEGMENTS_PATH_JETSTREAM=(
Path(__file__).parent.absolute() / "fixtures" / "invalid_segments_jetstream"
),
METRIC_HUB_SEGMENTS_PATH_DEFAULT=(
Path(__file__).parent.absolute() / "fixtures" / "invalid_segments_default"
),
)

Просмотреть файл

@ -0,0 +1,3 @@
[segments.invalid_segment]
friendly_name = "Invalid Segment"
description = "This segment belongs to an unknown application"

Просмотреть файл

@ -0,0 +1 @@
[segments.data_sources.segment_data_source]

Просмотреть файл

@ -0,0 +1,12 @@
[segments.desktop_segment_1]
friendly_name = "Desktop Segment 1"
description = "Firefox desktop segment used for testing"
select_expression = "country_code in ('IN', 'US')"
[segments.desktop_segment_2]
friendly_name = "Desktop Segment 2"
select_expression = "country_code in ('IN', 'US')"
[segments.desktop_segment_3]
friendly_name = "Desktop Segment 3"
description = "Firefox desktop segment used for testing"

Просмотреть файл

@ -0,0 +1,4 @@
[segments.fenix_segment]
friendly_name = "Fenix Segment"
description = "Fenix segment for testing"
select_expression = "{{agg_sum('ad_click')}}"

Просмотреть файл

@ -0,0 +1,127 @@
from django.core.checks import Error
from django.test import TestCase
from experimenter.experiments.models import NimbusExperiment
from experimenter.segments import Segment, Segments, check_segment_tomls
from experimenter.segments.tests import mock_invalid_segments, mock_valid_segments
@mock_valid_segments
class TestSegments(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Segments.clear_cache()
def test_load_all_segments(self):
segments = Segments.all()
self.assertEqual(len(segments), 4)
self.assertIn(
Segment(
slug="fenix_segment",
friendly_name="Fenix Segment",
application=NimbusExperiment.Application.FENIX,
description="Fenix segment for testing",
select_expression="{{agg_sum('ad_click')}}",
),
segments,
)
self.assertIn(
Segment(
slug="desktop_segment_1",
friendly_name="Desktop Segment 1",
application=NimbusExperiment.Application.DESKTOP,
description="Firefox desktop segment used for testing",
select_expression="country_code in ('IN', 'US')",
),
segments,
)
self.assertIn(
Segment(
slug="desktop_segment_2",
friendly_name="Desktop Segment 2",
application=NimbusExperiment.Application.DESKTOP,
description="",
select_expression="country_code in ('IN', 'US')",
),
segments,
)
self.assertIn(
Segment(
slug="desktop_segment_3",
friendly_name="Desktop Segment 3",
application=NimbusExperiment.Application.DESKTOP,
description="Firefox desktop segment used for testing",
select_expression="",
),
segments,
)
def test_load_segments_by_application(self):
fenix_segments = Segments.by_application(NimbusExperiment.Application.FENIX)
self.assertEqual(len(fenix_segments), 1)
self.assertIn(
Segment(
slug="fenix_segment",
friendly_name="Fenix Segment",
application=NimbusExperiment.Application.FENIX,
description="Fenix segment for testing",
select_expression="{{agg_sum('ad_click')}}",
),
fenix_segments,
)
desktop_segments = Segments.by_application(NimbusExperiment.Application.DESKTOP)
self.assertEqual(len(desktop_segments), 3)
self.assertIn(
Segment(
slug="desktop_segment_1",
friendly_name="Desktop Segment 1",
application=NimbusExperiment.Application.DESKTOP,
description="Firefox desktop segment used for testing",
select_expression="country_code in ('IN', 'US')",
),
desktop_segments,
)
self.assertIn(
Segment(
slug="desktop_segment_2",
friendly_name="Desktop Segment 2",
application=NimbusExperiment.Application.DESKTOP,
description="",
select_expression="country_code in ('IN', 'US')",
),
desktop_segments,
)
self.assertIn(
Segment(
slug="desktop_segment_3",
friendly_name="Desktop Segment 3",
application=NimbusExperiment.Application.DESKTOP,
description="Firefox desktop segment used for testing",
select_expression="",
),
desktop_segments,
)
class TestCheckSegmentTOMLs(TestCase):
def setUp(self):
Segments.clear_cache()
@mock_invalid_segments
def test_invalid_segments_do_trigger_check_error(self):
errors = check_segment_tomls(None)
self.assertEqual(
errors,
[Error(msg="Error loading Segment TOMLS: 'invalid_app_name'")],
)
@mock_valid_segments
def test_valid_segments_do_not_trigger_check_error(self):
errors = check_segment_tomls(None)
self.assertEqual(errors, [])

Просмотреть файл

@ -525,11 +525,18 @@ NIMBUS_SCHEMA_VERSION = (
) )
# Jetstream config paths METRIC_HUB_OUTCOMES_PATH = (
JETSTREAM_CONFIG_OUTCOMES_PATH = (
BASE_DIR / "outcomes" / "metric-hub-main" / "jetstream" / "outcomes" BASE_DIR / "outcomes" / "metric-hub-main" / "jetstream" / "outcomes"
) )
METRIC_HUB_SEGMENTS_PATH_JETSTREAM = (
BASE_DIR / "segments" / "metric-hub-main" / "jetstream" / "definitions"
)
METRIC_HUB_SEGMENTS_PATH_DEFAULT = (
BASE_DIR / "segments" / "metric-hub-main" / "definitions"
)
# Feature Manifest path # Feature Manifest path
FEATURE_MANIFESTS_PATH = BASE_DIR / "features" / "manifests" FEATURE_MANIFESTS_PATH = BASE_DIR / "features" / "manifests"