From a4b21b2c6dfa3bcf5a745b84703220ba93f4d6ca Mon Sep 17 00:00:00 2001 From: Alexey <70944468+Alexey-Samodurov@users.noreply.github.com> Date: Sat, 27 May 2023 12:32:02 +0300 Subject: [PATCH 1/2] add correct conn ip --- models/metrics/metrics.yml | 26 ++++++++++++++++++++++++++ profiles.yml | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/models/metrics/metrics.yml b/models/metrics/metrics.yml index 3822599..7a081b5 100644 --- a/models/metrics/metrics.yml +++ b/models/metrics/metrics.yml @@ -28,6 +28,19 @@ metrics: dimensions: [traffic_grouping, traffic_source, traffic_medium, traffic_campaign, device_category, location_country] + - name: actions + label: 'Actions' + model: ref('f_tracker') + description: '' + + calculation_method: count + expression: event_id + + timestamp: dt + time_grains: [day, week, month, quarter, year] + + dimensions: [traffic_grouping, traffic_source, traffic_medium, traffic_campaign, device_category, location_country] + - name: cpc label: 'Cost per Click' description: '' @@ -39,3 +52,16 @@ metrics: time_grains: [day, week, month, quarter, year] dimensions: [traffic_grouping, traffic_source, traffic_medium, traffic_campaign, device_category, location_country] + + - name: cpa + label: 'Cost per Action' + description: '' + + calculation_method: derived + expression: "{{ metric('costs') }} / {{ metric('actions') }}" + + timestamp: dt + time_grains: [day, week, month, quarter, year] + + dimensions: [traffic_grouping, traffic_source, traffic_medium, traffic_campaign, device_category, location_country] + diff --git a/profiles.yml b/profiles.yml index 570faa9..b17a383 100644 --- a/profiles.yml +++ b/profiles.yml @@ -10,7 +10,7 @@ mybi_dbt_showcase: prod: type: clickhouse - host: clickhouse + host: 127.0.0.1 port: 8123 user: default schema: analytics From 6a6504b8b01de48da2dd212cdcc1b7309714f413 Mon Sep 17 00:00:00 2001 From: Alexey <70944468+Alexey-Samodurov@users.noreply.github.com> Date: Sat, 27 May 2023 13:24:10 +0300 Subject: [PATCH 2/2] add immersions mart --- models/marts/marts.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/models/marts/marts.yml b/models/marts/marts.yml index 9af6550..6023e9d 100644 --- a/models/marts/marts.yml +++ b/models/marts/marts.yml @@ -41,3 +41,16 @@ models: description: Date tests: - not_null + + - name: f_immersions + columns: + - name: cost_id + description: surrogate key + tests: + - not_null + - unique: + severity: warn + - name: dt + description: Date + tests: + - not_null