-
Notifications
You must be signed in to change notification settings - Fork 5
/
q_visitor_pulse.view.lkml
executable file
·403 lines (343 loc) · 16.1 KB
/
q_visitor_pulse.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
view: q_visitor_pulse {
# Qubit LookML | Retail | V2
derived_table: {
sql:
SELECT
*
FROM
`qubit-client-{{q_view_v01.project._parameter_value}}.{{q_view_v01.site._parameter_value}}__v2.livetap_visitor_pulse`
WHERE
{% condition q_view_v01.time_data_points_date %} property_event_ts {% endcondition %}
;;
}
dimension: answer {
type: string
sql: ${TABLE}.answer ;;
description: "Answer given by the visitor, appropriate for the question type and order. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text"
}
dimension: answer_nontextarea {
type: string
sql: CASE WHEN ${TABLE}.question_type != 'textarea' THEN ${TABLE}.answer ELSE NULL END ;;
description: "Answer given by the visitor, appropriate for the question type and order, excluding textarea questions. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text"
}
dimension: answer_score {
type: number
sql: CASE WHEN ${TABLE}.question_type = 'score' THEN INTEGER(${TABLE}.answer) ELSE NULL END ;;
}
dimension: answer_radio_checkbox {
type: string
sql: CASE WHEN (${TABLE}.question_type = 'radio' OR ${TABLE}.question_type = 'checkbox') THEN ${TABLE}.answer ELSE NULL END ;;
}
dimension: answer_textarea {
type: string
sql: CASE WHEN ${TABLE}.question_type = 'textarea' THEN ${TABLE}.answer ELSE NULL END ;;
}
dimension: answer_input {
type: string
sql: CASE WHEN ${TABLE}.question_type = 'input' THEN ${TABLE}.answer ELSE NULL END ;;
}
dimension: context_id {
type: string
sql: ${TABLE}.context_id ;;
label: "Visitor"
description: "ID unique to the visitor. Only for views on which a survey was submitted. QP fields: context_id"
}
dimension: context_view_number {
type: number
sql: ${TABLE}.context_viewNumber ;;
label: "View Number"
description: "View number of the visitor, in a lifetime. Only for views on which a survey was submitted. QP fields: context_viewNumber"
}
dimension: meta_record_date {
type: string
sql: ${TABLE}.meta_recordDate ;;
hidden: yes
}
dimension: meta_server_ts {
type: number
sql: ${TABLE}.meta_serverTs ;;
hidden: yes
}
dimension: meta_tracking_id {
type: string
sql: ${TABLE}.meta_trackingId ;;
hidden: yes
}
dimension: entrance_id {
type: string
sql: ${TABLE}.entrance_id ;;
hidden: yes
}
dimension: session_id {
type: string
sql: ${TABLE}.session_id ;;
hidden: yes
}
dimension: page_subtype {
type: string
sql: ${TABLE}.page_subtype ;;
label: "Subtype"
group_label: "Page"
description: "Page subtype. QP fields: subtypes"
}
dimension: page_type {
type: string
sql: ${TABLE}.page_type ;;
label: "Type"
group_label: "Page"
description: "Can be either home, category, product, checkout, transaction, help, contact or other. QP fields: type"
}
dimension_group: time_data_points {
label: ""
type: time
timeframes: [time, hour_of_day, date, day_of_week, week, week_of_year, month, month_name, quarter_of_year, year]
sql: ${TABLE}.property_event_ts ;;
group_label: "⏰ Date & Time"
description: "Timestamp of the page view. QP fields: meta_serverTs (with applied UTC offset, for your timezone)"
hidden: yes
}
dimension: meta_url {
type: string
sql: ${TABLE}.meta_url ;;
label: "URL"
description: "URL address on which a survey was submitted. QP fields: meta_url"
}
dimension: question_freetext {
type: string
sql: ${TABLE}.question_freetext ;;
group_label: "Question"
description: "Additional freetext submitted by visitor (e.g. 'Other' free-form box to fill in). QP fields: question_type, value_boolean, choice_text, value_text"
}
dimension: question_order {
type: number
sql: ${TABLE}.question_order ;;
group_label: "Question"
description: "Question order aligned with the order of questions in the UI. QP fields: question_order"
}
dimension: question_id {
type: number
sql: ${TABLE}.question_id ;;
group_label: "Question"
description: "ID unique to the question within a survey. QP fields: question_id"
}
dimension: question_text {
type: string
sql: ${TABLE}.question_text ;;
group_label: "Question"
description: "The actual question text that appeared within survey. QP fields: question_text"
}
dimension: question_text_score {
type: string
sql: CASE WHEN ${TABLE}.question_type = 'score' THEN ${TABLE}.question_text ELSE NULL END ;;
group_label: "Score Question Text"
}
dimension: question_text_radio_checkbox {
type: string
sql: CASE WHEN (${TABLE}.question_type = 'radio' OR ${TABLE}.question_type = 'checkbox') THEN ${TABLE}.question_text ELSE NULL END ;;
group_label: "Radio / Checkbox Question Text"
}
dimension: question_text_textarea {
type: string
sql: CASE WHEN ${TABLE}.question_type = 'textarea' THEN ${TABLE}.question_text ELSE NULL END ;;
group_label: "Textarea Question Text"
}
dimension: question_text_nontextarea {
type: string
sql: CASE WHEN ${TABLE}.question_type != 'textarea' THEN ${TABLE}.question_text ELSE NULL END ;;
group_label: "Question"
description: "The actual question text that appeared within survey, excluding textarea question texts. QP fields: question_text"
}
dimension: question_type {
type: string
sql: ${TABLE}.question_type ;;
group_label: "Question"
description: "One of four possible types of question: checkbox, radio, textarea, score. QP fields: question_type"
}
dimension: survey_id {
type: string
sql: ${TABLE}.survey_id ;;
description: "ID unique to the survey iteration. QP fields: survey_id"
}
dimension: survey_total_questions {
type: string
sql: ${TABLE}.survey_totalQuestions ;;
description: "Total questions asked in a survey. QP fields: survey_totalQuestions"
}
dimension: user_survey_answer_1 {
type: string
sql: ${TABLE}.user_survey_answer_1 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 1. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_2 {
type: string
sql: ${TABLE}.user_survey_answer_2 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 2. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_20 {
type: string
sql: ${TABLE}.user_survey_answer_20 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 20. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_3 {
type: string
sql: ${TABLE}.user_survey_answer_3 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 3. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_4 {
type: string
sql: ${TABLE}.user_survey_answer_4 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 4. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_5 {
type: string
sql: ${TABLE}.user_survey_answer_5 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 5. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_6 {
type: string
sql: ${TABLE}.user_survey_answer_6 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 6. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_7 {
type: string
sql: ${TABLE}.user_survey_answer_7 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 7. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_8 {
type: string
sql: ${TABLE}.user_survey_answer_8 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 8. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_9 {
type: string
sql: ${TABLE}.user_survey_answer_9 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 9. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_10 {
type: string
sql: ${TABLE}.user_survey_answer_10 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 10. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_11 {
type: string
sql: ${TABLE}.user_survey_answer_11 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 11. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_12 {
type: string
sql: ${TABLE}.user_survey_answer_12 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 12. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_13 {
type: string
sql: ${TABLE}.user_survey_answer_13 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 13. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_14 {
type: string
sql: ${TABLE}.user_survey_answer_14 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 14. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_15 {
type: string
sql: ${TABLE}.user_survey_answer_15 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 15. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_16 {
type: string
sql: ${TABLE}.user_survey_answer_16 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 16. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_17 {
type: string
sql: ${TABLE}.user_survey_answer_17 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 17. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_18 {
type: string
sql: ${TABLE}.user_survey_answer_18 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 18. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_answer_19 {
type: string
sql: ${TABLE}.user_survey_answer_19 ;;
group_label: "Filter by Answers to Other Questions"
description: "Answer to question of question_order = 19. For filtering purposes. QP fields: question_type, value_integer, value_text, question_type, value_boolean, choice_text, context_id, context_viewNumber"
}
dimension: user_survey_response_id {
type: string
sql: ${TABLE}.user_survey_response_id ;;
group_label: "Filter by Answers to Other Questions"
description: "ID unique to survey response submitted by the visitor. QP fields: context_id, context_viewNumber"
}
dimension: view_id {
type: string
sql: ${TABLE}.view_id ;;
hidden: yes
primary_key: yes
}
measure: last_answer_date {
type: date
sql: MAX(${q_visitor_pulse_v01.time_data_points_date}) ;;
}
measure: survey_visitors {
type: count_distinct
sql: ${TABLE}.context_id ;;
description: "Count of unique visitor_ids. Only for views on which a survey was submitted. QP fields: context_id"
}
measure: surveys_count {
type: number
sql: COUNT(DISTINCT survey_id) ;;
description: "Count of unique survey_ids (always exact count). QP fields: survey_id"
}
measure: total_answers {
type: number
sql: COUNT(DISTINCT unique_row_id) ;;
description: "Count of unique answer IDs. If a survey contains 3 questions, the result for a single submission will be 3. If there are 3 submissions, 3 questions each, the result will be 9 etc.. QP fields: context_id, context_viewNumber, question_order, question_type, value_integer, value_text, question_type, value_boolean, choice_text"
}
measure: total_unanswered_questions {
type: number
sql: COUNT(DISTINCT IF(answer IS NULL, unique_row_id,NULL)) ;;
description: "Count of unique answer IDs, only for unanswered questions. If a survey contains 3 questions, but one answer was left blank, the result for a single submission will be 1. QP fields: context_id, context_viewNumber, question_order, question_type, value_integer, value_text, question_type, value_boolean, choice_text"
}
measure: total_answered_questions {
type: number
sql: COUNT(DISTINCT IF(answer IS NOT NULL, unique_row_id,NULL)) ;;
description: "Count of unique answer IDs, only for answered questions. If a survey contains 3 questions, but one answer was left blank, the result for a single submission will be 2. QP fields: context_id, context_viewNumber, question_order, question_type, value_integer, value_text, question_type, value_boolean, choice_text"
}
measure: average_score {
type: average_distinct
sql: CASE WHEN ${TABLE}.question_type = 'score' THEN CAST(${TABLE}.answer AS INT64) ELSE NULL END ;;
sql_distinct_key: ${TABLE}.view_id ;;
value_format_name: "decimal_2"
description: ""
}
measure: nps {
type: number
sql: (COUNT(DISTINCT CASE WHEN question_type = 'score' AND INTEGER(answer) >= 9 THEN unique_row_id ELSE NULL END) /
COUT(DISTINCT CASE WHEN question_type = 'score' THEN unique_row_id ELSE NULL END)) -
COUNT(DISTINCT CASE WHEN question_type = 'score' AND INTEGER(answer) <= 6 THEN unique_row_id ELSE NULL END) /
COUNT(DISTINCT CASE WHEN question_type = 'score' THEN unique_row_id ELSE NULL END) ;;
value_format_name: "percent_2"
label: "NPS"
}
}