forked from llooker/doubleclick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doubleclick.model.lkml
210 lines (181 loc) · 6.68 KB
/
doubleclick.model.lkml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
connection: "doubleclick"
# include all the views
include: "*.view"
# include all the dashboards
include: "*.dashboard"
persist_for: "24 hours"
explore: impression {
label: "Impressions"
view_label: "Impressions"
join: match_table_ads {
view_label: "Ads"
sql_on: ${impression.ad_id} = ${match_table_ads.ad_id} ;;
relationship: many_to_one
}
join: match_table_campaigns {
view_label: "Campaigns"
sql_on: ${impression.campaign_id} = ${match_table_campaigns.campaign_id} ;;
relationship: many_to_one
}
join: match_table_advertisers {
view_label: "Advertisers"
sql_on: ${impression.advertiser_id} = ${match_table_advertisers.advertiser_id} ;;
relationship: many_to_one
}
join: match_table_ad_placement_assignments {
view_label: "Ad Placements"
sql_on: ${impression.ad_id} = ${match_table_ad_placement_assignments.ad_id} and ${impression.placement_id} = ${match_table_ad_placement_assignments.placement_id} ;;
relationship: many_to_one
}
join: match_table_browsers {
view_label: "Browsers"
sql_on: ${impression.browser_platform_id} = ${match_table_browsers.browser_platform_id} ;;
relationship: many_to_one
}
}
explore: impression_funnel {
join: match_table_campaigns {
view_label: "Campaigns"
sql_on: ${impression_funnel.campaign_id} = ${match_table_campaigns.campaign_id} ;;
relationship: many_to_one
}
join: match_table_ads {
view_label: "Ads"
sql_on: ${impression_funnel.ad_id} = ${match_table_ads.ad_id} ;;
relationship: many_to_one
}
join: match_table_advertisers {
view_label: "Advertisers"
sql_on: ${impression_funnel.advertiser_id} = ${match_table_advertisers.advertiser_id} ;;
relationship: many_to_one
}
join: user_campaign_facts {
view_label: "Users"
sql_on: ${impression_funnel.campaign_id} = ${user_campaign_facts.campaign_id} AND ${impression_funnel.user_id} = ${user_campaign_facts.user_id} ;;
relationship: many_to_one
}
}
explore: activity {
label: "Activities"
view_label: "Activities"
join: match_table_ads {
view_label: "Ads"
sql_on: ${activity.ad_id} = ${match_table_ads.ad_id} ;;
relationship: many_to_one
}
join: match_table_campaigns {
view_label: "Campaigns"
sql_on: ${activity.campaign_id} = ${match_table_campaigns.campaign_id} ;;
relationship: many_to_one
}
join: match_table_advertisers {
view_label: "Advertisers"
sql_on: ${activity.advertiser_id} = ${match_table_advertisers.advertiser_id} ;;
relationship: many_to_one
}
join: match_table_ad_placement_assignments {
view_label: "Ad Placements"
sql_on: ${activity.ad_id} = ${match_table_ad_placement_assignments.ad_id} and ${activity.placement_id} = ${match_table_ad_placement_assignments.placement_id} ;;
relationship: many_to_one
}
join: match_table_browsers {
view_label: "Browsers"
sql_on: ${activity.browser_platform_id} = ${match_table_browsers.browser_platform_id} ;;
relationship: many_to_one
}
}
explore: click {
label: "Clicks"
view_label: "Clicks"
join: match_table_ads {
view_label: "Ads"
sql_on: ${click.ad_id} = ${match_table_ads.ad_id} ;;
relationship: many_to_one
}
join: match_table_campaigns {
view_label: "Campaigns"
sql_on: ${click.campaign_id} = ${match_table_campaigns.campaign_id} ;;
relationship: many_to_one
}
join: match_table_advertisers {
view_label: "Advertisers"
sql_on: ${click.advertiser_id} = ${match_table_advertisers.advertiser_id} ;;
relationship: many_to_one
}
join: match_table_ad_placement_assignments {
view_label: "Ad Placements"
sql_on: ${click.ad_id} = ${match_table_ad_placement_assignments.ad_id} and ${click.placement_id} = ${match_table_ad_placement_assignments.placement_id} ;;
relationship: many_to_one
}
join: match_table_browsers {
view_label: "Browsers"
sql_on: ${click.browser_platform_id} = ${match_table_browsers.browser_platform_id} ;;
relationship: many_to_one
}
}
# - explore: campaign_date_table
# always_filter:
# campaign_date_table.calendar_date: 7 days
# joins:
# - join: impression_campaign_date
# view_label: "Impression"
# sql_on: |
# ${campaign_date_table.campaign_id} = ${impression_campaign_date.campaign_id} and
# ${campaign_date_table.calendar_date} = ${impression_campaign_date.impression_date} and
# ${campaign_date_table.ad_id} = ${impression_campaign_date.ad_id}
# # and {% condition campaign_date_table.calendar_date %} TIMESTAMP(impression._DATA_DATE) {% endcondition %}
# relationship: one_to_many
# fields: [count_impressions, distinct_users]
# - join: activity
# sql_on: |
# ${campaign_date_table.campaign_id} = ${activity.campaign_id} and
# ${campaign_date_table.calendar_date} = ${activity.activity_date}
# # and {% condition campaign_date_table.calendar_date %} TIMESTAMP(activity._DATA_DATE) {% endcondition %}
# relationship: one_to_many
# fields: [count_activities, distinct_users]
# always_filter:
# date_filter: '30 Days'
# joins:
# - join: match_table_ads
# sql_on: ${activity.ad_id} = ${match_table_ads.ad_id}
# relationship: many_to_one
#
# - join: match_table_campaigns
# sql_on: ${activity.campaign_id} = ${match_table_campaigns.campaign_id}
# relationship: many_to_one
#
# - join: match_table_advertisers
# sql_on: ${activity.advertiser_id} = ${match_table_advertisers.advertiser_id}
# relationship: many_to_one
#
# - join: match_table_ad_placement_assignments
# sql_on: ${activity.ad_id} = ${match_table_ad_placement_assignments.ad_id} and ${activity.placement_id} = ${match_table_ad_placement_assignments.placement_id}
# relationship: many_to_one
#
# - join: match_table_browsers
# sql_on: ${activity.browser_platform_id} = ${match_table_browsers.browser_platform_id}
# relationship: many_to_one
#
# - explore: click
# always_filter:
# date_filter: '30 Days'
# joins:
# - join: match_table_ads
# sql_on: ${click.ad_id} = ${match_table_ads.ad_id}
# relationship: many_to_one
#
# - join: match_table_campaigns
# sql_on: ${click.campaign_id} = ${match_table_campaigns.campaign_id}
# relationship: many_to_one
#
# - join: match_table_advertisers
# sql_on: ${click.advertiser_id} = ${match_table_advertisers.advertiser_id}
# relationship: many_to_one
#
# - join: match_table_ad_placement_assignments
# sql_on: ${click.ad_id} = ${match_table_ad_placement_assignments.ad_id} and ${click.placement_id} = ${match_table_ad_placement_assignments.placement_id}
# relationship: many_to_one
#
# - join: match_table_browsers
# sql_on: ${click.browser_platform_id} = ${match_table_browsers.browser_platform_id}
# relationship: many_to_one