-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathchannel_traffic_source_a2_ycr.view.lkml
199 lines (174 loc) · 4.34 KB
/
channel_traffic_source_a2_ycr.view.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
view: channel_traffic_source_a2_ycr {
sql_table_name: youtube_channel_reports.channel_traffic_source_a2_ycr ;;
dimension_group: _data {
type: time
timeframes: [
raw,
date,
week,
month,
quarter,
year
]
convert_tz: no
sql: ${TABLE}._DATA_DATE ;;
}
dimension_group: _latest {
type: time
timeframes: [
raw,
date,
week,
month,
quarter,
year
]
convert_tz: no
sql: ${TABLE}._LATEST_DATE ;;
}
dimension: channel_id {
type: string
sql: ${TABLE}.channel_id ;;
}
dimension: country_code {
hidden: yes
type: string
sql: ${TABLE}.country_code ;;
}
dimension: date {
type: string
sql: ${TABLE}.date ;;
}
dimension: live_or_on_demand {
type: string
sql: ${TABLE}.live_or_on_demand ;;
}
dimension: subscribed_status {
type: string
sql: ${TABLE}.subscribed_status ;;
}
dimension: traffic_source_detail {
type: string
sql: ${TABLE}.traffic_source_detail ;;
}
dimension: traffic_source_type {
hidden: yes
type: number
sql: ${TABLE}.traffic_source_type ;;
}
dimension: source_type {
drill_fields: [traffic_source_detail]
type: string
sql: CASE
WHEN ${traffic_source_type}=0 THEN 'Direct'
WHEN ${traffic_source_type}=1 THEN 'YT Advertizing'
WHEN ${traffic_source_type}=3 THEN 'Browse'
WHEN ${traffic_source_type}=4 THEN 'Channels'
WHEN ${traffic_source_type}=5 THEN 'Youtube Search'
WHEN ${traffic_source_type}=7 THEN 'Suggested Videos'
WHEN ${traffic_source_type}=8 THEN 'Other YT Features'
WHEN ${traffic_source_type}=9 THEN 'External'
WHEN ${traffic_source_type}=11 THEN 'Cards'
WHEN ${traffic_source_type}=14 THEN 'Playlists'
WHEN ${traffic_source_type}=17 THEN 'Notifications'
WHEN ${traffic_source_type}=18 THEN 'Playlist Page'
WHEN ${traffic_source_type}=19 THEN 'Claimed Content'
WHEN ${traffic_source_type}=20 THEN 'End Screen'
END
;;
}
dimension: video_id {
type: string
sql: ${TABLE}.video_id ;;
html: <p> Video Title </p> ;;
}
############################
####### YouTube Metrics ##########
############################
dimension: average_view_duration_percentage {
# hidden: yes
type: number
sql: ${TABLE}.average_view_duration_percentage ;;
}
dimension: average_view_duration_percentage_tier {
type: tier
sql: ${average_view_duration_percentage} ;;
tiers: [0,25,50,75,100]
allow_fill: no
style: relational
}
measure: avg_view_duration_percentage {
label: "Average View Duration (percentage)"
type: average
sql: ${average_view_duration_percentage} ;;
value_format_name: percent_1
}
dimension: video_length_seconds {
hidden: yes
type: number
sql: ROUND(${average_view_duration_seconds}/(nullif(${average_view_duration_percentage}/100,0)) );;
}
dimension: average_view_duration_seconds {
hidden: yes
type: number
sql: ${TABLE}.average_view_duration_seconds ;;
}
dimension: average_view_duration_minutes_tier {
type: tier
sql: ${average_view_duration_seconds}/60 ;;
tiers: [0,0.5,1,1.5,2,3,4,5,10,30,60]
allow_fill: no
style: relational
}
measure: avg_view_duration_s {
label: "Average View Duration (seconds)"
type: average
sql: ${average_view_duration_seconds} ;;
value_format_name: decimal_1
}
dimension: red_views {
type: number
sql: ${TABLE}.red_views ;;
}
measure: total_red_views {
type: sum
sql: ${red_views} ;;
}
measure: average_red_views {
type: average
sql: ${red_views} ;;
}
dimension: red_watch_time_minutes {
type: number
sql: ${TABLE}.red_watch_time_minutes ;;
}
dimension: views {
hidden: yes
type: number
sql: ${TABLE}.views ;;
}
measure: total_views {
type: sum
sql: ${views} ;;
}
measure: average_views {
type: average
sql: ${views} ;;
}
dimension: watch_time_minutes {
type: number
sql: ${TABLE}.watch_time_minutes ;;
}
measure: total_watch_time_minutes {
type: sum
sql: ${watch_time_minutes} ;;
}
measure: video_count {
type: count_distinct
sql: ${video_id} ;;
drill_fields: []
}
set: video_detail {
fields: [video_id, total_views,]
}
}