Skip to content

Commit

Permalink
de-duplicated activations when we refer use activation_log, add valua…
Browse files Browse the repository at this point in the history
…tion_target logic
  • Loading branch information
doryokujin committed Mar 5, 2024
1 parent 7c4789a commit c7104c4
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 6 deletions.
6 changes: 3 additions & 3 deletions scenarios/cdp_campaign_management/common/gsheet_settings.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gsheet:
result_connection: ******
sheet_folder: ******
spreadsheet_title: cdp_campaign_management
# result_connection: ******
# sheet_folder: ******
# spreadsheet_title: cdp_campaign_management
53 changes: 53 additions & 0 deletions scenarios/cdp_campaign_management/common/user_settings_sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,40 @@ td:
timezone: JST
# valuation_target: 'activation'
ps:
- 244539
- 507568


user_id:
244539: td_client_id
507568: td_client_id

valuation_target:
244539: activation
507568: click

activations_tables:
507568:
scan_journey_tables: true

clicks_tables:
244539:
-
is_audience_table: false
db: treasurebikes
table: behv_website
url_col: td_url
time_col: time
filter: td_url IS NOT NULL
# use_distinct: true
-
is_audience_table: true
# db:
table: behavior_behv_orders
url_col: td_url
# time_col: timestamp
# filter:
# use_distinct: true
507568:
-
is_audience_table: false
Expand All @@ -31,6 +55,35 @@ td:
# use_distinct: true

conversions_tables:
244539:
-
is_audience_table: false
db: treasurebikes
table: behv_website
filter: td_subscription = 'true'
cv_name: SUBSCRIBE
time_col: time
val_col: 1
acquired_revenue_per_person: 20000
# use_distinct: false
-
is_audience_table: true
table: behavior_behv_website
filter: td_app IN ('Android', 'iOS')
cv_name: DOWNLOAD
# time_col: timestamp
val_col: 1
acquired_revenue_per_person: 20000
# use_distinct: false
-
is_audience_table: true
table: behavior_behv_orders
filter: checkout_event = 'true'
cv_name: PURCHASE
# time_col: timestamp
val_col: total_order
acquired_revenue_per_person: 1
# use_distinct: false
507568:
-
is_audience_table: false
Expand Down
3 changes: 3 additions & 0 deletions scenarios/cdp_campaign_management/incremental_ingest.dig
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ _export:


+ingest_mta_conversion_journeys:
_export:
valuation_target: "${td.valuation_target == null || td.valuation_target[ps_id] == null || td.valuation_target[ps_id] == 'click' ? 'Activation' : 'Click'}"

+ingest_to_tmp_table:
td>: queries/ingest_mta_conversion_journeys.sql
create_table: ${td.tables.tmp_mta_conversion_journeys}
Expand Down
3 changes: 3 additions & 0 deletions scenarios/cdp_campaign_management/initial_ingest.dig
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ _export:
dest_table: ${td.tables.conversion_journeys}

+ingest_mta_conversion_journeys:
_export:
valuation_target: "${td.valuation_target == null || td.valuation_target[ps_id] == null || td.valuation_target[ps_id] == 'click' ? 'Activation' : 'Click'}"

+ingest_to_tmp_table:
td>: queries/ingest_mta_conversion_journeys.sql
create_table: ${td.tables.tmp_mta_conversion_journeys}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@ WITH tbl_base_activations AS
FROM
(
SELECT
time
,identifier AS ${user_id}
identifier AS ${user_id}
,audience_id
,NULL AS cdp_customer_id
,CAST(activation_id AS VARCHAR) AS syndication_id
,CAST(segment_id AS VARCHAR) AS segment_id
,segment_name
,activation_name
,integration_type AS connector_type
,MIN(time) AS time
FROM ${cdp_audience_db}.${td.tables.activation_log}
WHERE identifier_type = '${user_id}'
AND CAST(audience_id AS VARCHAR) = '${ps_id}'
AND TD_TIME_RANGE(time,${time_from},${time_to})
GROUP BY 1,2,3,4,5,6,7,8
) t1
LEFT OUTER JOIN
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WITH tbl_cv_history AS
AND raw_data.cv_name = cv_history.cv_name
WHERE raw_data.time <= cv_history.time
AND raw_data.${user_id} <= cv_history.${user_id}
AND type <> '${valuation_target=="activation" ? "Click" : "Activation"}'
AND type <> '${valuation_target}'
)
WHERE cv_order = 1
)
Expand Down

0 comments on commit c7104c4

Please sign in to comment.