@metarouter/ajs-starter-kit 1.0.32 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.dist/actioniq/endpoint_schema.etag.json +1 -1
  2. package/.dist/actioniq/endpoint_schema.json +18 -3
  3. package/.dist/actioniq/kit.etag.json +1 -1
  4. package/.dist/actioniq/metadata.json +4 -0
  5. package/.dist/amplitude/endpoint_schema.etag.json +1 -1
  6. package/.dist/amplitude/endpoint_schema.json +12 -1
  7. package/.dist/amplitude/kit.etag.json +1 -1
  8. package/.dist/amplitude/metadata.json +4 -0
  9. package/.dist/amplitude/playbook.etag.json +1 -1
  10. package/.dist/amplitude/playbook.json +769 -89
  11. package/.dist/blueshift/endpoint_schema.etag.json +1 -1
  12. package/.dist/blueshift/endpoint_schema.json +7 -2
  13. package/.dist/blueshift/kit.etag.json +1 -1
  14. package/.dist/blueshift/metadata.json +4 -0
  15. package/.dist/braze/endpoint_schema.etag.json +1 -1
  16. package/.dist/braze/endpoint_schema.json +41 -1
  17. package/.dist/braze/kit.etag.json +1 -1
  18. package/.dist/braze/metadata.json +4 -0
  19. package/.dist/braze/playbook.etag.json +1 -1
  20. package/.dist/braze/playbook.json +217 -22
  21. package/.dist/connection-schemas.json +12 -0
  22. package/.dist/facebook-pixel/endpoint_schema.etag.json +1 -1
  23. package/.dist/facebook-pixel/endpoint_schema.json +7 -2
  24. package/.dist/facebook-pixel/kit.etag.json +1 -1
  25. package/.dist/facebook-pixel/metadata.json +8 -0
  26. package/.dist/facebook-pixel/playbook.etag.json +1 -1
  27. package/.dist/facebook-pixel/playbook.json +321 -24
  28. package/.dist/mixpanel/endpoint_schema.etag.json +1 -0
  29. package/.dist/mixpanel/endpoint_schema.json +39 -0
  30. package/.dist/mixpanel/kit.etag.json +1 -0
  31. package/.dist/mixpanel/metadata.json +19 -0
  32. package/.dist/mixpanel/playbook.etag.json +1 -0
  33. package/.dist/mixpanel/playbook.json +71 -0
  34. package/.dist/roomvo/endpoint_schema.etag.json +1 -1
  35. package/.dist/roomvo/endpoint_schema.json +5 -0
  36. package/.dist/roomvo/kit.etag.json +1 -1
  37. package/.dist/roomvo/metadata.json +4 -0
  38. package/.dist/roomvo/playbook.etag.json +1 -1
  39. package/.dist/roomvo/playbook.json +31 -1
  40. package/index.js +15 -4
  41. package/package.json +1 -1
@@ -6,16 +6,14 @@
6
6
  "exampleValue": "my-api-key"
7
7
  }
8
8
  ],
9
- "global": {
10
- "enrichments": [
11
- {
12
- "staticString": "$$API_KEY$$",
13
- "outputKey": "api_key"
14
- }
15
- ]
16
- },
17
9
  "eventSpecific": {
18
10
  "identify": {
11
+ "enrichments": [
12
+ {
13
+ "staticString": "$$API_KEY$$",
14
+ "outputKey": "api_key"
15
+ }
16
+ ],
19
17
  "mappings": [
20
18
  {
21
19
  "inputKey": "input",
@@ -24,7 +22,7 @@
24
22
  {
25
23
  "expression": {
26
24
  "lang": "lua",
27
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nlocal user_props = input.traits or {}\nuser_props['user_id'] = input.userId\nuser_props['device_id'] = input.anonymousId\nuser_props['message_id'] = input.messageId\nuser_props['referrer'] = input.context.page.referrer or \"\"\nuser_props['referring_domain'] = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\"\nuser_props['utm_source'] = input.context.campaign.source\nuser_props['utm_medium'] = input.context.campaign.medium\nuser_props['utm_campaign'] = input.context.campaign.name\nuser_props['utm_term'] = input.context.campaign.term\nuser_props['utm_content'] = input.context.campaign.content\nuser_props['gclid'] = url.gclid\nuser_props['dclid'] = url.dclid\nuser_props['fbclid'] = url.fbclid\n\nreturn {\n user_id = input.userId,\n device_id = input.anonymousId,\n user_properties = user_props,\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}"
25
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nlocal user_props = input.traits or {}\nuser_props['user_id'] = input.userId\nuser_props['device_id'] = input.anonymousId\nuser_props['message_id'] = input.messageId\nuser_props['referrer'] = input.context.page.referrer or \"\"\nuser_props['referring_domain'] = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\"\nuser_props['utm_source'] = input.context.campaign.source\nuser_props['utm_medium'] = input.context.campaign.medium\nuser_props['utm_campaign'] = input.context.campaign.name\nuser_props['utm_term'] = input.context.campaign.term\nuser_props['utm_content'] = input.context.campaign.content\nuser_props['gclid'] = DECODE_URL_QUERY(input.context.page.url).gclid\nuser_props['dclid'] = DECODE_URL_QUERY(input.context.page.url).dclid\nuser_props['fbclid'] = DECODE_URL_QUERY(input.context.page.url).fbclid\n\nreturn {\n user_id = input.userId,\n device_id = input.anonymousId,\n user_properties = user_props,\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}"
28
26
  }
29
27
  }
30
28
  ]
@@ -32,114 +30,721 @@
32
30
  ]
33
31
  },
34
32
  "page": {
33
+ "enrichments": [
34
+ {
35
+ "staticString": "Loaded a Page",
36
+ "outputKey": "event_type"
37
+ }
38
+ ],
35
39
  "mappings": [
36
40
  {
37
- "inputKey": "input",
38
- "outputKey": "events",
39
- "transforms": [
40
- {
41
- "expression": {
42
- "lang": "lua",
43
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nreturn {{\n user_id = input.userId,\n device_id = input.anonymousId,\n insert_id = input.messageId,\n event_type = 'Loaded a Page',\n event_properties = {\n category = input.properties.category,\n name = input.properties.name,\n },\n user_properties = {\n user_id = input.userId,\n device_id = input.anonymousId,\n referrer = input.context.page.referrer or \"\",\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n utm_source = input.context.campaign.source,\n utm_medium = input.context.campaign.medium,\n utm_campaign = input.context.campaign.name,\n utm_term = input.context.campaign.term,\n utm_content = input.context.campaign.content,\n gclid = url.gclid,\n dclid = url.dclid,\n fbclid = url.fbclid,\n },\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}}"
44
- }
45
- }
46
- ]
41
+ "inputKey": "userId",
42
+ "outputKey": "user_id"
43
+ },
44
+ {
45
+ "inputKey": "anonymousId",
46
+ "outputKey": "device_id"
47
+ },
48
+ {
49
+ "inputKey": "messageId",
50
+ "outputKey": "insert_id"
51
+ },
52
+ {
53
+ "inputKey": "properties.category",
54
+ "outputKey": "event_properties.category"
55
+ },
56
+ {
57
+ "inputKey": "properties.name",
58
+ "outputKey": "event_properties.name"
59
+ },
60
+ {
61
+ "inputKey": "userId",
62
+ "outputKey": "user_properties.user_id"
63
+ },
64
+ {
65
+ "inputKey": "anonymousId",
66
+ "outputKey": "user_properties.device_id"
67
+ },
68
+ {
69
+ "inputKey": "context.app.version",
70
+ "outputKey": "app_version"
71
+ },
72
+ {
73
+ "inputKey": "context.os.name",
74
+ "outputKey": "os_name"
75
+ },
76
+ {
77
+ "inputKey": "context.os.version",
78
+ "outputKey": "os_version"
79
+ },
80
+ {
81
+ "inputKey": "context.device.manufacturer",
82
+ "outputKey": "device_manufacturer"
83
+ },
84
+ {
85
+ "inputKey": "context.device.model",
86
+ "outputKey": "device_model"
87
+ },
88
+ {
89
+ "inputKey": "context.network.carrier",
90
+ "outputKey": "carrier"
91
+ },
92
+ {
93
+ "inputKey": "context.ip",
94
+ "outputKey": "ip"
95
+ },
96
+ {
97
+ "inputKey": "context.userAgent",
98
+ "outputKey": "user_agent"
99
+ },
100
+ {
101
+ "inputKey": "context.campaign.source",
102
+ "outputKey": "user_properties.utm_source"
103
+ },
104
+ {
105
+ "inputKey": "context.campaign.medium",
106
+ "outputKey": "user_properties.utm_medium"
107
+ },
108
+ {
109
+ "inputKey": "context.campaign.name",
110
+ "outputKey": "user_properties.utm_campaign"
111
+ },
112
+ {
113
+ "inputKey": "context.campaign.term",
114
+ "outputKey": "user_properties.utm_term"
115
+ },
116
+ {
117
+ "inputKey": "context.campaign.content",
118
+ "outputKey": "user_properties.utm_content"
119
+ },
120
+ {
121
+ "inputKey": "context.page.referrer",
122
+ "outputKey": "user_properties.referrer",
123
+ "defaultString": ""
124
+ }
125
+ ],
126
+ "expressions": [
127
+ {
128
+ "lang": "lua",
129
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nreturn {\n user_properties = {\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n gclid = DECODE_URL_QUERY(input.context.page.url).gclid,\n dclid = DECODE_URL_QUERY(input.context.page.url).dclid,\n fbclid = DECODE_URL_QUERY(input.context.page.url).fbclid,\n },\n platform = getPlatform(input.context.device.type),\n}"
47
130
  }
48
131
  ]
49
132
  },
50
133
  "products_searched": {
134
+ "enrichments": [
135
+ {
136
+ "staticString": "Search Completed",
137
+ "outputKey": "event_type"
138
+ }
139
+ ],
51
140
  "mappings": [
52
141
  {
53
- "inputKey": "input",
54
- "outputKey": "events",
55
- "transforms": [
56
- {
57
- "expression": {
58
- "lang": "lua",
59
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nreturn {{\n user_id = input.userId,\n device_id = input.anonymousId,\n insert_id = input.messageId,\n event_type = 'Search Completed',\n event_properties = {\n keywords= input.properties.query,\n },\n user_properties = {\n user_id = input.userId,\n device_id = input.anonymousId,\n referrer = input.context.page.referrer or \"\",\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n utm_source = input.context.campaign.source,\n utm_medium = input.context.campaign.medium,\n utm_campaign = input.context.campaign.name,\n utm_term = input.context.campaign.term,\n utm_content = input.context.campaign.content,\n gclid = url.gclid,\n dclid = url.dclid,\n fbclid = url.fbclid,\n },\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}}"
60
- }
61
- }
62
- ]
142
+ "inputKey": "userId",
143
+ "outputKey": "user_id"
144
+ },
145
+ {
146
+ "inputKey": "anonymousId",
147
+ "outputKey": "device_id"
148
+ },
149
+ {
150
+ "inputKey": "messageId",
151
+ "outputKey": "insert_id"
152
+ },
153
+ {
154
+ "inputKey": "properties.query",
155
+ "outputKey": "event_properties.keywords"
156
+ },
157
+ {
158
+ "inputKey": "userId",
159
+ "outputKey": "user_properties.user_id"
160
+ },
161
+ {
162
+ "inputKey": "anonymousId",
163
+ "outputKey": "user_properties.device_id"
164
+ },
165
+ {
166
+ "inputKey": "context.app.version",
167
+ "outputKey": "app_version"
168
+ },
169
+ {
170
+ "inputKey": "context.os.name",
171
+ "outputKey": "os_name"
172
+ },
173
+ {
174
+ "inputKey": "context.os.version",
175
+ "outputKey": "os_version"
176
+ },
177
+ {
178
+ "inputKey": "context.device.manufacturer",
179
+ "outputKey": "device_manufacturer"
180
+ },
181
+ {
182
+ "inputKey": "context.device.model",
183
+ "outputKey": "device_model"
184
+ },
185
+ {
186
+ "inputKey": "context.network.carrier",
187
+ "outputKey": "carrier"
188
+ },
189
+ {
190
+ "inputKey": "context.ip",
191
+ "outputKey": "ip"
192
+ },
193
+ {
194
+ "inputKey": "context.userAgent",
195
+ "outputKey": "user_agent"
196
+ },
197
+ {
198
+ "inputKey": "context.campaign.source",
199
+ "outputKey": "user_properties.utm_source"
200
+ },
201
+ {
202
+ "inputKey": "context.campaign.medium",
203
+ "outputKey": "user_properties.utm_medium"
204
+ },
205
+ {
206
+ "inputKey": "context.campaign.name",
207
+ "outputKey": "user_properties.utm_campaign"
208
+ },
209
+ {
210
+ "inputKey": "context.campaign.term",
211
+ "outputKey": "user_properties.utm_term"
212
+ },
213
+ {
214
+ "inputKey": "context.campaign.content",
215
+ "outputKey": "user_properties.utm_content"
216
+ },
217
+ {
218
+ "inputKey": "context.page.referrer",
219
+ "outputKey": "user_properties.referrer",
220
+ "defaultString": ""
221
+ }
222
+ ],
223
+ "expressions": [
224
+ {
225
+ "lang": "lua",
226
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nreturn {\n user_properties = {\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n gclid = DECODE_URL_QUERY(input.context.page.url).gclid,\n dclid = DECODE_URL_QUERY(input.context.page.url).dclid,\n fbclid = DECODE_URL_QUERY(input.context.page.url).fbclid,\n },\n platform = getPlatform(input.context.device.type),\n}"
63
227
  }
64
228
  ]
65
229
  },
66
230
  "product_list_viewed": {
231
+ "enrichments": [
232
+ {
233
+ "staticString": "Product List Viewed",
234
+ "outputKey": "event_type"
235
+ }
236
+ ],
67
237
  "mappings": [
68
238
  {
69
- "inputKey": "input",
70
- "outputKey": "events",
71
- "transforms": [
72
- {
73
- "expression": {
74
- "lang": "lua",
75
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nreturn {{\n user_id = input.userId,\n device_id = input.anonymousId,\n insert_id = input.messageId,\n event_type = 'Product List Viewed',\n event_properties = {\n list_category = input.properties.category,\n list_id = input.properties.list_id,\n },\n user_properties = {\n user_id = input.userId,\n device_id = input.anonymousId,\n referrer = input.context.page.referrer or \"\",\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n utm_source = input.context.campaign.source,\n utm_medium = input.context.campaign.medium,\n utm_campaign = input.context.campaign.name,\n utm_term = input.context.campaign.term,\n utm_content = input.context.campaign.content,\n gclid = url.gclid,\n dclid = url.dclid,\n fbclid = url.fbclid,\n },\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}}"
76
- }
77
- }
78
- ]
239
+ "inputKey": "userId",
240
+ "outputKey": "user_id"
241
+ },
242
+ {
243
+ "inputKey": "anonymousId",
244
+ "outputKey": "device_id"
245
+ },
246
+ {
247
+ "inputKey": "messageId",
248
+ "outputKey": "insert_id"
249
+ },
250
+ {
251
+ "inputKey": "properties.category",
252
+ "outputKey": "event_properties.list_category"
253
+ },
254
+ {
255
+ "inputKey": "properties.list_id",
256
+ "outputKey": "event_properties.list_id"
257
+ },
258
+ {
259
+ "inputKey": "userId",
260
+ "outputKey": "user_properties.user_id"
261
+ },
262
+ {
263
+ "inputKey": "anonymousId",
264
+ "outputKey": "user_properties.device_id"
265
+ },
266
+ {
267
+ "inputKey": "context.app.version",
268
+ "outputKey": "app_version"
269
+ },
270
+ {
271
+ "inputKey": "context.os.name",
272
+ "outputKey": "os_name"
273
+ },
274
+ {
275
+ "inputKey": "context.os.version",
276
+ "outputKey": "os_version"
277
+ },
278
+ {
279
+ "inputKey": "context.device.manufacturer",
280
+ "outputKey": "device_manufacturer"
281
+ },
282
+ {
283
+ "inputKey": "context.device.model",
284
+ "outputKey": "device_model"
285
+ },
286
+ {
287
+ "inputKey": "context.network.carrier",
288
+ "outputKey": "carrier"
289
+ },
290
+ {
291
+ "inputKey": "context.ip",
292
+ "outputKey": "ip"
293
+ },
294
+ {
295
+ "inputKey": "context.userAgent",
296
+ "outputKey": "user_agent"
297
+ },
298
+ {
299
+ "inputKey": "context.campaign.source",
300
+ "outputKey": "user_properties.utm_source"
301
+ },
302
+ {
303
+ "inputKey": "context.campaign.medium",
304
+ "outputKey": "user_properties.utm_medium"
305
+ },
306
+ {
307
+ "inputKey": "context.campaign.name",
308
+ "outputKey": "user_properties.utm_campaign"
309
+ },
310
+ {
311
+ "inputKey": "context.campaign.term",
312
+ "outputKey": "user_properties.utm_term"
313
+ },
314
+ {
315
+ "inputKey": "context.campaign.content",
316
+ "outputKey": "user_properties.utm_content"
317
+ },
318
+ {
319
+ "inputKey": "context.page.referrer",
320
+ "outputKey": "user_properties.referrer",
321
+ "defaultString": ""
322
+ }
323
+ ],
324
+ "expressions": [
325
+ {
326
+ "lang": "lua",
327
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nreturn {\n user_properties = {\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n gclid = DECODE_URL_QUERY(input.context.page.url).gclid,\n dclid = DECODE_URL_QUERY(input.context.page.url).dclid,\n fbclid = DECODE_URL_QUERY(input.context.page.url).fbclid,\n },\n platform = getPlatform(input.context.device.type),\n}"
79
328
  }
80
329
  ]
81
330
  },
82
331
  "product_viewed": {
332
+ "enrichments": [
333
+ {
334
+ "staticString": "Product Viewed",
335
+ "outputKey": "event_type"
336
+ }
337
+ ],
83
338
  "mappings": [
84
339
  {
85
- "inputKey": "input",
86
- "outputKey": "events",
87
- "transforms": [
88
- {
89
- "expression": {
90
- "lang": "lua",
91
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nreturn {{\n user_id = input.userId,\n device_id = input.anonymousId,\n insert_id = input.messageId,\n event_type = 'Product Viewed',\n event_properties = {\n product_name = input.properties.name,\n product_sku = input.properties.sku,\n product_id = input.properties.product_id,\n product_category = input.properties.category,\n product_price = input.properties.price,\n },\n user_properties = {\n user_id = input.userId,\n device_id = input.anonymousId,\n referrer = input.context.page.referrer or \"\",\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n utm_source = input.context.campaign.source,\n utm_medium = input.context.campaign.medium,\n utm_campaign = input.context.campaign.name,\n utm_term = input.context.campaign.term,\n utm_content = input.context.campaign.content,\n gclid = url.gclid,\n dclid = url.dclid,\n fbclid = url.fbclid,\n },\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}}"
92
- }
93
- }
94
- ]
340
+ "inputKey": "userId",
341
+ "outputKey": "user_id"
342
+ },
343
+ {
344
+ "inputKey": "anonymousId",
345
+ "outputKey": "device_id"
346
+ },
347
+ {
348
+ "inputKey": "messageId",
349
+ "outputKey": "insert_id"
350
+ },
351
+ {
352
+ "inputKey": "properties.name",
353
+ "outputKey": "event_properties.product_name"
354
+ },
355
+ {
356
+ "inputKey": "properties.sku",
357
+ "outputKey": "event_properties.product_sku"
358
+ },
359
+ {
360
+ "inputKey": "properties.product_id",
361
+ "outputKey": "event_properties.product_id"
362
+ },
363
+ {
364
+ "inputKey": "properties.category",
365
+ "outputKey": "event_properties.product_category"
366
+ },
367
+ {
368
+ "inputKey": "properties.price",
369
+ "outputKey": "event_properties.product_price"
370
+ },
371
+ {
372
+ "inputKey": "userId",
373
+ "outputKey": "user_properties.user_id"
374
+ },
375
+ {
376
+ "inputKey": "anonymousId",
377
+ "outputKey": "user_properties.device_id"
378
+ },
379
+ {
380
+ "inputKey": "context.app.version",
381
+ "outputKey": "app_version"
382
+ },
383
+ {
384
+ "inputKey": "context.os.name",
385
+ "outputKey": "os_name"
386
+ },
387
+ {
388
+ "inputKey": "context.os.version",
389
+ "outputKey": "os_version"
390
+ },
391
+ {
392
+ "inputKey": "context.device.manufacturer",
393
+ "outputKey": "device_manufacturer"
394
+ },
395
+ {
396
+ "inputKey": "context.device.model",
397
+ "outputKey": "device_model"
398
+ },
399
+ {
400
+ "inputKey": "context.network.carrier",
401
+ "outputKey": "carrier"
402
+ },
403
+ {
404
+ "inputKey": "context.ip",
405
+ "outputKey": "ip"
406
+ },
407
+ {
408
+ "inputKey": "context.userAgent",
409
+ "outputKey": "user_agent"
410
+ },
411
+ {
412
+ "inputKey": "context.campaign.source",
413
+ "outputKey": "user_properties.utm_source"
414
+ },
415
+ {
416
+ "inputKey": "context.campaign.medium",
417
+ "outputKey": "user_properties.utm_medium"
418
+ },
419
+ {
420
+ "inputKey": "context.campaign.name",
421
+ "outputKey": "user_properties.utm_campaign"
422
+ },
423
+ {
424
+ "inputKey": "context.campaign.term",
425
+ "outputKey": "user_properties.utm_term"
426
+ },
427
+ {
428
+ "inputKey": "context.campaign.content",
429
+ "outputKey": "user_properties.utm_content"
430
+ },
431
+ {
432
+ "inputKey": "context.page.referrer",
433
+ "outputKey": "user_properties.referrer",
434
+ "defaultString": ""
435
+ }
436
+ ],
437
+ "expressions": [
438
+ {
439
+ "lang": "lua",
440
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nreturn {\n user_properties = {\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n gclid = DECODE_URL_QUERY(input.context.page.url).gclid,\n dclid = DECODE_URL_QUERY(input.context.page.url).dclid,\n fbclid = DECODE_URL_QUERY(input.context.page.url).fbclid,\n },\n platform = getPlatform(input.context.device.type),\n}"
95
441
  }
96
442
  ]
97
443
  },
98
444
  "product_added": {
445
+ "enrichments": [
446
+ {
447
+ "staticString": "Product Added",
448
+ "outputKey": "event_type"
449
+ }
450
+ ],
99
451
  "mappings": [
100
452
  {
101
- "inputKey": "input",
102
- "outputKey": "events",
103
- "transforms": [
104
- {
105
- "expression": {
106
- "lang": "lua",
107
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nreturn {{\n user_id = input.userId,\n device_id = input.anonymousId,\n insert_id = input.messageId,\n event_type = 'Product Added',\n event_properties = {\n product_name = input.properties.name,\n product_sku = input.properties.sku,\n product_id = input.properties.product_id,\n product_category = input.properties.category,\n product_price = input.properties.price,\n product_quantity = input.properties.quantity,\n },\n user_properties = {\n user_id = input.userId,\n device_id = input.anonymousId,\n referrer = input.context.page.referrer or \"\",\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n utm_source = input.context.campaign.source,\n utm_medium = input.context.campaign.medium,\n utm_campaign = input.context.campaign.name,\n utm_term = input.context.campaign.term,\n utm_content = input.context.campaign.content,\n gclid = url.gclid,\n dclid = url.dclid,\n fbclid = url.fbclid,\n },\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}}"
108
- }
109
- }
110
- ]
453
+ "inputKey": "userId",
454
+ "outputKey": "user_id"
455
+ },
456
+ {
457
+ "inputKey": "anonymousId",
458
+ "outputKey": "device_id"
459
+ },
460
+ {
461
+ "inputKey": "messageId",
462
+ "outputKey": "insert_id"
463
+ },
464
+ {
465
+ "inputKey": "properties.name",
466
+ "outputKey": "event_properties.product_name"
467
+ },
468
+ {
469
+ "inputKey": "properties.sku",
470
+ "outputKey": "event_properties.product_sku"
471
+ },
472
+ {
473
+ "inputKey": "properties.product_id",
474
+ "outputKey": "event_properties.product_id"
475
+ },
476
+ {
477
+ "inputKey": "properties.category",
478
+ "outputKey": "event_properties.product_category"
479
+ },
480
+ {
481
+ "inputKey": "properties.price",
482
+ "outputKey": "event_properties.product_price"
483
+ },
484
+ {
485
+ "inputKey": "properties.quantity",
486
+ "outputKey": "event_properties.product_quantity"
487
+ },
488
+ {
489
+ "inputKey": "userId",
490
+ "outputKey": "user_properties.user_id"
491
+ },
492
+ {
493
+ "inputKey": "anonymousId",
494
+ "outputKey": "user_properties.device_id"
495
+ },
496
+ {
497
+ "inputKey": "context.app.version",
498
+ "outputKey": "app_version"
499
+ },
500
+ {
501
+ "inputKey": "context.os.name",
502
+ "outputKey": "os_name"
503
+ },
504
+ {
505
+ "inputKey": "context.os.version",
506
+ "outputKey": "os_version"
507
+ },
508
+ {
509
+ "inputKey": "context.device.manufacturer",
510
+ "outputKey": "device_manufacturer"
511
+ },
512
+ {
513
+ "inputKey": "context.device.model",
514
+ "outputKey": "device_model"
515
+ },
516
+ {
517
+ "inputKey": "context.network.carrier",
518
+ "outputKey": "carrier"
519
+ },
520
+ {
521
+ "inputKey": "context.ip",
522
+ "outputKey": "ip"
523
+ },
524
+ {
525
+ "inputKey": "context.userAgent",
526
+ "outputKey": "user_agent"
527
+ },
528
+ {
529
+ "inputKey": "context.campaign.source",
530
+ "outputKey": "user_properties.utm_source"
531
+ },
532
+ {
533
+ "inputKey": "context.campaign.medium",
534
+ "outputKey": "user_properties.utm_medium"
535
+ },
536
+ {
537
+ "inputKey": "context.campaign.name",
538
+ "outputKey": "user_properties.utm_campaign"
539
+ },
540
+ {
541
+ "inputKey": "context.campaign.term",
542
+ "outputKey": "user_properties.utm_term"
543
+ },
544
+ {
545
+ "inputKey": "context.campaign.content",
546
+ "outputKey": "user_properties.utm_content"
547
+ },
548
+ {
549
+ "inputKey": "context.page.referrer",
550
+ "outputKey": "user_properties.referrer",
551
+ "defaultString": ""
552
+ }
553
+ ],
554
+ "expressions": [
555
+ {
556
+ "lang": "lua",
557
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nreturn {\n user_properties = {\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n gclid = DECODE_URL_QUERY(input.context.page.url).gclid,\n dclid = DECODE_URL_QUERY(input.context.page.url).dclid,\n fbclid = DECODE_URL_QUERY(input.context.page.url).fbclid,\n },\n platform = getPlatform(input.context.device.type),\n}"
111
558
  }
112
559
  ]
113
560
  },
114
561
  "cart_viewed": {
562
+ "enrichments": [
563
+ {
564
+ "staticString": "Cart Viewed",
565
+ "outputKey": "event_type"
566
+ }
567
+ ],
115
568
  "mappings": [
116
569
  {
117
- "inputKey": "input",
118
- "outputKey": "events",
119
- "transforms": [
120
- {
121
- "expression": {
122
- "lang": "lua",
123
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nreturn {{\n user_id = input.userId,\n device_id = input.anonymousId,\n insert_id = input.messageId,\n event_type = 'Cart Viewed',\n event_properties = {\n total_cart_size = #input.properties.products,\n total_cart_value = SUM(MAP(input.properties.products, function (p) return p.price * (p.quantity or 1) end)),\n cart_id = input.properties.cart_id,\n },\n user_properties = {\n user_id = input.userId,\n device_id = input.anonymousId,\n referrer = input.context.page.referrer or \"\",\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n utm_source = input.context.campaign.source,\n utm_medium = input.context.campaign.medium,\n utm_campaign = input.context.campaign.name,\n utm_term = input.context.campaign.term,\n utm_content = input.context.campaign.content,\n gclid = url.gclid,\n dclid = url.dclid,\n fbclid = url.fbclid,\n },\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}}"
124
- }
125
- }
126
- ]
570
+ "inputKey": "userId",
571
+ "outputKey": "user_id"
572
+ },
573
+ {
574
+ "inputKey": "anonymousId",
575
+ "outputKey": "device_id"
576
+ },
577
+ {
578
+ "inputKey": "messageId",
579
+ "outputKey": "insert_id"
580
+ },
581
+ {
582
+ "inputKey": "properties.cart_id",
583
+ "outputKey": "event_properties.cart_id"
584
+ },
585
+ {
586
+ "inputKey": "userId",
587
+ "outputKey": "user_properties.user_id"
588
+ },
589
+ {
590
+ "inputKey": "anonymousId",
591
+ "outputKey": "user_properties.device_id"
592
+ },
593
+ {
594
+ "inputKey": "context.app.version",
595
+ "outputKey": "app_version"
596
+ },
597
+ {
598
+ "inputKey": "context.os.name",
599
+ "outputKey": "os_name"
600
+ },
601
+ {
602
+ "inputKey": "context.os.version",
603
+ "outputKey": "os_version"
604
+ },
605
+ {
606
+ "inputKey": "context.device.manufacturer",
607
+ "outputKey": "device_manufacturer"
608
+ },
609
+ {
610
+ "inputKey": "context.device.model",
611
+ "outputKey": "device_model"
612
+ },
613
+ {
614
+ "inputKey": "context.network.carrier",
615
+ "outputKey": "carrier"
616
+ },
617
+ {
618
+ "inputKey": "context.ip",
619
+ "outputKey": "ip"
620
+ },
621
+ {
622
+ "inputKey": "context.userAgent",
623
+ "outputKey": "user_agent"
624
+ },
625
+ {
626
+ "inputKey": "context.campaign.source",
627
+ "outputKey": "user_properties.utm_source"
628
+ },
629
+ {
630
+ "inputKey": "context.campaign.medium",
631
+ "outputKey": "user_properties.utm_medium"
632
+ },
633
+ {
634
+ "inputKey": "context.campaign.name",
635
+ "outputKey": "user_properties.utm_campaign"
636
+ },
637
+ {
638
+ "inputKey": "context.campaign.term",
639
+ "outputKey": "user_properties.utm_term"
640
+ },
641
+ {
642
+ "inputKey": "context.campaign.content",
643
+ "outputKey": "user_properties.utm_content"
644
+ },
645
+ {
646
+ "inputKey": "context.page.referrer",
647
+ "outputKey": "user_properties.referrer",
648
+ "defaultString": ""
649
+ }
650
+ ],
651
+ "expressions": [
652
+ {
653
+ "lang": "lua",
654
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nreturn {\n event_properties = {\n total_cart_size = #input.properties.products,\n total_cart_value = SUM(MAP(input.properties.products, function (p) return p.price * (p.quantity or 1) end)),\n },\n user_properties = {\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n gclid = DECODE_URL_QUERY(input.context.page.url).gclid,\n dclid = DECODE_URL_QUERY(input.context.page.url).dclid,\n fbclid = DECODE_URL_QUERY(input.context.page.url).fbclid,\n },\n platform = getPlatform(input.context.device.type),\n}"
127
655
  }
128
656
  ]
129
657
  },
130
658
  "order_completed": {
659
+ "enrichments": [
660
+ {
661
+ "staticString": "Order Completed",
662
+ "outputKey": "event_type"
663
+ }
664
+ ],
131
665
  "mappings": [
132
666
  {
133
- "inputKey": "input",
134
- "outputKey": "events",
135
- "transforms": [
136
- {
137
- "expression": {
138
- "lang": "lua",
139
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nlocal props = {\n cart_id = input.properties.cart_id,\n total_cart_size = #input.properties.products,\n total_cart_value = SUM(MAP(input.properties.products, function (p) return p.price * (p.quantity or 1) end)),\n promo_code_applied = input.properties.coupon,\n order_total = input.properties.total,\n total_discounts = input.properties.discount,\n order_id = input.properties.order_id,\n total_shipping = input.properties.shipping,\n total_tax = input.properties.tax,\n}\n\nprops['$revenue'] = TO_FLOAT(input.properties.revenue)\n\nreturn {{\n user_id = input.userId,\n device_id = input.anonymousId,\n insert_id = input.messageId,\n event_type = 'Order Completed',\n event_properties = props,\n user_properties = {\n user_id = input.userId,\n device_id = input.anonymousId,\n referrer = input.context.page.referrer or \"\",\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n utm_source = input.context.campaign.source,\n utm_medium = input.context.campaign.medium,\n utm_campaign = input.context.campaign.name,\n utm_term = input.context.campaign.term,\n utm_content = input.context.campaign.content,\n gclid = url.gclid,\n dclid = url.dclid,\n fbclid = url.fbclid,\n },\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}}"
140
- }
141
- }
142
- ]
667
+ "inputKey": "userId",
668
+ "outputKey": "user_id"
669
+ },
670
+ {
671
+ "inputKey": "anonymousId",
672
+ "outputKey": "device_id"
673
+ },
674
+ {
675
+ "inputKey": "messageId",
676
+ "outputKey": "insert_id"
677
+ },
678
+ {
679
+ "inputKey": "userId",
680
+ "outputKey": "user_properties.user_id"
681
+ },
682
+ {
683
+ "inputKey": "anonymousId",
684
+ "outputKey": "user_properties.device_id"
685
+ },
686
+ {
687
+ "inputKey": "context.app.version",
688
+ "outputKey": "app_version"
689
+ },
690
+ {
691
+ "inputKey": "context.os.name",
692
+ "outputKey": "os_name"
693
+ },
694
+ {
695
+ "inputKey": "context.os.version",
696
+ "outputKey": "os_version"
697
+ },
698
+ {
699
+ "inputKey": "context.device.manufacturer",
700
+ "outputKey": "device_manufacturer"
701
+ },
702
+ {
703
+ "inputKey": "context.device.model",
704
+ "outputKey": "device_model"
705
+ },
706
+ {
707
+ "inputKey": "context.network.carrier",
708
+ "outputKey": "carrier"
709
+ },
710
+ {
711
+ "inputKey": "context.ip",
712
+ "outputKey": "ip"
713
+ },
714
+ {
715
+ "inputKey": "context.userAgent",
716
+ "outputKey": "user_agent"
717
+ },
718
+ {
719
+ "inputKey": "context.campaign.source",
720
+ "outputKey": "user_properties.utm_source"
721
+ },
722
+ {
723
+ "inputKey": "context.campaign.medium",
724
+ "outputKey": "user_properties.utm_medium"
725
+ },
726
+ {
727
+ "inputKey": "context.campaign.name",
728
+ "outputKey": "user_properties.utm_campaign"
729
+ },
730
+ {
731
+ "inputKey": "context.campaign.term",
732
+ "outputKey": "user_properties.utm_term"
733
+ },
734
+ {
735
+ "inputKey": "context.campaign.content",
736
+ "outputKey": "user_properties.utm_content"
737
+ },
738
+ {
739
+ "inputKey": "context.page.referrer",
740
+ "outputKey": "user_properties.referrer",
741
+ "defaultString": ""
742
+ }
743
+ ],
744
+ "expressions": [
745
+ {
746
+ "lang": "lua",
747
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nlocal props = {\n cart_id = input.properties.cart_id,\n total_cart_size = #input.properties.products,\n total_cart_value = SUM(MAP(input.properties.products, function (p) return p.price * (p.quantity or 1) end)),\n promo_code_applied = input.properties.coupon,\n order_total = input.properties.total,\n total_discounts = input.properties.discount,\n order_id = input.properties.order_id,\n total_shipping = input.properties.shipping,\n total_tax = input.properties.tax,\n}\n\nprops['$revenue'] = TO_FLOAT(input.properties.revenue)\n\nreturn {\n event_properties = props,\n user_properties = {\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n gclid = DECODE_URL_QUERY(input.context.page.url).gclid,\n dclid = DECODE_URL_QUERY(input.context.page.url).dclid,\n fbclid = DECODE_URL_QUERY(input.context.page.url).fbclid,\n },\n platform = getPlatform(input.context.device.type),\n}"
143
748
  }
144
749
  ]
145
750
  }
@@ -147,16 +752,91 @@
147
752
  "default": {
148
753
  "mappings": [
149
754
  {
150
- "inputKey": "input",
151
- "outputKey": "events",
152
- "transforms": [
153
- {
154
- "expression": {
155
- "lang": "lua",
156
- "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nfunction urldecode(s)\n s = s:gsub('+', ' ')\n :gsub('%%(%x%x)', function(h)\n return string.char(tonumber(h, 16))\n end)\n return s\nend\n\nfunction parseurl(s)\n local ans = {}\n for k,v in s:gmatch('([^&=?]-)=([^&=?]+)' ) do\n ans[ k ] = urldecode(v)\n end\n return ans\nend\n\nlocal url = parseurl(input.context.page.url)\n\nlocal props = input.properties or {}\n\nreturn {{\n user_id = input.userId,\n device_id = input.anonymousId,\n insert_id = input.messageId,\n event_type = input.event,\n event_properties = props,\n user_properties = {\n user_id = input.userId,\n device_id = input.anonymousId,\n referrer = input.context.page.referrer or \"\",\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n utm_source = input.context.campaign.source,\n utm_medium = input.context.campaign.medium,\n utm_campaign = input.context.campaign.name,\n utm_term = input.context.campaign.term,\n utm_content = input.context.campaign.content,\n gclid = url.gclid,\n dclid = url.dclid,\n fbclid = url.fbclid,\n },\n app_version = input.context.app.version,\n platform = getPlatform(input.context.device.type),\n os_name = input.context.os.name,\n os_version = input.context.os.version,\n device_manufacturer = input.context.device.manufacturer,\n device_model = input.context.device.model,\n carrier = input.context.network.carrier,\n ip = input.context.ip,\n user_agent = input.context.userAgent,\n}}"
157
- }
158
- }
159
- ]
755
+ "inputKey": "event",
756
+ "outputKey": "event_type"
757
+ },
758
+ {
759
+ "inputKey": "userId",
760
+ "outputKey": "user_id"
761
+ },
762
+ {
763
+ "inputKey": "anonymousId",
764
+ "outputKey": "device_id"
765
+ },
766
+ {
767
+ "inputKey": "messageId",
768
+ "outputKey": "insert_id"
769
+ },
770
+ {
771
+ "inputKey": "userId",
772
+ "outputKey": "user_properties.user_id"
773
+ },
774
+ {
775
+ "inputKey": "anonymousId",
776
+ "outputKey": "user_properties.device_id"
777
+ },
778
+ {
779
+ "inputKey": "context.app.version",
780
+ "outputKey": "app_version"
781
+ },
782
+ {
783
+ "inputKey": "context.os.name",
784
+ "outputKey": "os_name"
785
+ },
786
+ {
787
+ "inputKey": "context.os.version",
788
+ "outputKey": "os_version"
789
+ },
790
+ {
791
+ "inputKey": "context.device.manufacturer",
792
+ "outputKey": "device_manufacturer"
793
+ },
794
+ {
795
+ "inputKey": "context.device.model",
796
+ "outputKey": "device_model"
797
+ },
798
+ {
799
+ "inputKey": "context.network.carrier",
800
+ "outputKey": "carrier"
801
+ },
802
+ {
803
+ "inputKey": "context.ip",
804
+ "outputKey": "ip"
805
+ },
806
+ {
807
+ "inputKey": "context.userAgent",
808
+ "outputKey": "user_agent"
809
+ },
810
+ {
811
+ "inputKey": "context.campaign.source",
812
+ "outputKey": "user_properties.utm_source"
813
+ },
814
+ {
815
+ "inputKey": "context.campaign.medium",
816
+ "outputKey": "user_properties.utm_medium"
817
+ },
818
+ {
819
+ "inputKey": "context.campaign.name",
820
+ "outputKey": "user_properties.utm_campaign"
821
+ },
822
+ {
823
+ "inputKey": "context.campaign.term",
824
+ "outputKey": "user_properties.utm_term"
825
+ },
826
+ {
827
+ "inputKey": "context.campaign.content",
828
+ "outputKey": "user_properties.utm_content"
829
+ },
830
+ {
831
+ "inputKey": "context.page.referrer",
832
+ "outputKey": "user_properties.referrer",
833
+ "defaultString": ""
834
+ }
835
+ ],
836
+ "expressions": [
837
+ {
838
+ "lang": "lua",
839
+ "body": "function getPlatform (type)\n local t = LOWER(type) or ''\n if t == 'ios' then\n return 'iOS'\n elseif t == 'android' then\n return 'Android'\n else\n return 'Web'\n end\nend\n\nlocal props = input.properties or {}\n\nreturn {\n event_properties = props,\n user_properties = {\n referring_domain = SPLIT(SPLIT(input.context.page.referrer, \"//\", 2)[2], \"/\", 2)[1] or \"\",\n gclid = DECODE_URL_QUERY(input.context.page.url).gclid,\n dclid = DECODE_URL_QUERY(input.context.page.url).dclid,\n fbclid = DECODE_URL_QUERY(input.context.page.url).fbclid,\n },\n platform = getPlatform(input.context.device.type),\n}"
160
840
  }
161
841
  ]
162
842
  }