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 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