forked from llooker/braze_message_engagement_block
-
Notifications
You must be signed in to change notification settings - Fork 0
/
users_campaigns_conversion.view.lkml
132 lines (114 loc) · 3.29 KB
/
users_campaigns_conversion.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
# Campaign Conversions
view: users_campaigns_conversion {
sql_table_name: BRAZE.PASSENGERS_CAMPAIGNS_CONVERSION ;;
dimension: id {
primary_key: yes
description: "unique id of this event"
hidden: yes
type: string
sql: ${TABLE}."ID" ;;
}
dimension: app_id {
description: "id of the app"
type: string
sql: ${TABLE}."APP_ID" ;;
}
dimension: campaign_id {
description: "id of the campaign"
type: string
sql: ${TABLE}."CAMPAIGN_ID" ;;
}
dimension: campaign_name {
description: "name of the campaign"
type: string
sql: ${TABLE}."CAMPAIGN_NAME" ;;
}
# the below dimensions use Snowflake syntax to turn a json string into code that can be queried.
# use the proper code for your SQL dialect.
dimension: conversion_behavior {
description: "JSON-encoded string describing the conversion behavior"
hidden: yes
type: string
sql: parse_json(${TABLE}."CONVERSION_BEHAVIOR");;
}
dimension: conversion_behavior_index {
description: "index of the conversion behavior"
hidden: yes
type: number
sql: ${TABLE}."CONVERSION_BEHAVIOR_INDEX" ;;
}
dimension: conversion_behavior_type {
description: "type of the conversion behavior"
type: string
sql: ${conversion_behavior}:type::STRING ;;
}
dimension: conversion_window {
description: "window of time to perform the conversion behavior in seconds"
type: number
sql: ${conversion_behavior}:window::NUMBER ;;
}
dimension: conversion_custom_event_name {
description: "if the conversion was a custom event, the name of custom event"
type: string
sql: ${conversion_behavior}:custom_event_name::STRING ;;
}
dimension_group: converted_time {
description: "timestamp of the conversion"
type: time
datatype: epoch
timeframes: [
raw,
time,
date,
week,
month,
quarter,
year
]
sql: ${TABLE}."TIME" ;;
}
dimension: converted_timezone {
description: "IANA timezone of the user at the time of the event"
hidden: yes
type: string
sql: ${TABLE}."TIMEZONE" ;;
}
dimension: external_user_id {
description: "External ID of the user"
type: string
sql: ${TABLE}."EXTERNAL_USER_ID" ;;
}
dimension: message_variation_id {
description: "id of the message variation if from a campaign"
type: string
sql: ${TABLE}."MESSAGE_VARIATION_ID" ;;
}
dimension: send_id {
description: "id of the message if specified for the campaign"
hidden: yes
type: string
sql: ${TABLE}."SEND_ID" ;;
}
dimension: user_id {
description: "Braze user ID"
type: string
sql: ${TABLE}."USER_ID" ;;
}
dimension: user_in_control {
description: "is this user in the control group for this campaign"
type: yesno
sql: ${users_campaigns_enrollincontrol.user_id}=${user_id}
AND
${users_campaigns_enrollincontrol.message_variation_id}=${message_variation_id};;
}
measure: campaign_conversion_event_count {
description: "distinct count of campaign conversion behavior event IDs"
type: count_distinct
sql: ${TABLE}."ID" ;;
}
measure: unique_users_that_converted_on_a_campaign {
description: "distinct count of Braze user IDs who converted on a campaign"
type: count_distinct
sql: ${TABLE}."USER_ID" ;;
}
}