Attributionの例 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Advanced SQL Engine分析関数

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
2020年6月
Language
日本語
Last Update
2021-03-30
dita:mapPath
ja-JP/mld1565890109978.ditamap
dita:ditavalPath
ja-JP/mld1565890109978.ditaval
dita:id
B035-1206
Product Category
Software
Teradata Vantage

イベント タイプ チャネル

この例では、属性の重みを以下のイベントとチャネルに割り当てるモデルを使用します。

イベントのタイプ チャネル
変換 SocialNetwork、PaidSearch
含まれません Email
オプション Direct、Referral、OrganicSearch

入力

attribution_sample_table1
user_id イベント time_stamp
1 impression 2001-09-27 23:00:01
1 impression 2001-09-27 23:00:05
1 Email 2001-09-27 23:00:15
2 impression 2001-09-27 23:00:31
2 impression 2001-09-27 23:00:51
attribution_sample_table2
user_id event time_stamp
1 impression 2001-09-27 23:00:19
1 SocialNetwork 2001-09-27 23:00:20
1 Direct 2001-09-27 23:00:21
1 Referral 2001-09-27 23:00:22
1 PaidSearch 2001-09-27 23:00:23
2 impression 2001-09-27 23:00:29
2 impression 2001-09-27 23:00:31
2 impression 2001-09-27 23:00:33
2 impression 2001-09-27 23:00:36
2 impression 2001-09-27 23:00:38
conversion_event_table
conversion_events
PaidSearch
SocialNetwork
excluding_event_table
excluding_events
Email
optional_event_table
optional_events
Direct
OrganicSearch
Referral

次の2つのモデル テーブルは、それぞれ行と秒単位の分散モデルを適用します。

model1_table
id model
0 SEGMENT_ROWS
1 3:0.5:EXPONENTIAL:0.5,SECOND
2 4:0.3:WEIGHTED:0.4,0.3,0.2,0.1
3 3:0.2:FIRST_CLICK:NA
model2_table
id model
0 SEGMENT_SECONDS
1 6:0.5:UNIFORM:NA
2 8:0.3:LAST_CLICK:NA
3 6:0.2:FIRST_CLICK:NA

SQL呼び出し

SELECT * FROM Attribution (
   ON attribution_sample_table1 AS InputTable1
     PARTITION BY user_id ORDER BY time_stamp
   ON attribution_sample_table2 AS InputTable2
     PARTITION BY user_id ORDER BY time_stamp
   ON conversion_event_table AS ConversionEventTable DIMENSION
   ON excluding_event_table AS ExcludedEventTable DIMENSION
   ON optional_event_table AS OptionalEventTable DIMENSION
   ON model1_table AS FirstModel DIMENSION
   ON model2_table AS SecondModel DIMENSION
  USING
   EventColumn ('event')
   TimeColumn ('time_stamp')
   WindowSize ('rows:10&seconds:20')
  ) AS dt ORDER BY user_id, time_stamp;

出力

user_id event time_stamp attribution time_to_conversion
1 impression 2001-09-27 23:00:01 0.285714 -19
1 impression 2001-09-27 23:00:05 0  
1 impression 2001-09-27 23:00:19 0.714286 -1
1 SocialNetwork 2001-09-27 23:00:20    
1 Direct 2001-09-27 23:00:21 0.5 -2
1 Referral 2001-09-27 23:00:22 0.5 -1
1 PaidSearch 2001-09-27 23:00:23