@metarouter/ajs-starter-kit 1.0.71 → 1.0.73
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.
- package/.dist/convert/connection.etag.json +1 -0
- package/.dist/convert/connection.json +26 -0
- package/.dist/convert/kit.etag.json +1 -0
- package/.dist/convert/metadata.json +20 -0
- package/.dist/convert/playbook.etag.json +1 -0
- package/.dist/convert/playbook.json +317 -0
- package/index.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"f76e21ba19d19a5876d05fbef7a2a62f"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"params": [
|
|
3
|
+
{
|
|
4
|
+
"name": "PROJECT_ID",
|
|
5
|
+
"exampleValue": "my-project-id"
|
|
6
|
+
}
|
|
7
|
+
],
|
|
8
|
+
"default": {
|
|
9
|
+
"endpoint": "https://$$PROJECT_ID$$.metrics.convertexperiments.com/track",
|
|
10
|
+
"method": "POST",
|
|
11
|
+
"headers": [
|
|
12
|
+
{
|
|
13
|
+
"key": "Content-Type",
|
|
14
|
+
"value": "application/json"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"key": "Accept-Encoding",
|
|
18
|
+
"value": "gzip, compress, br"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"key": "User-Agent",
|
|
22
|
+
"fromEventKey": "context.userAgent"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"c959e548809caaca8508107d03fc7d8d"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"isDraft": true,
|
|
3
|
+
"isBeta": true,
|
|
4
|
+
"friendlyName": "Convert",
|
|
5
|
+
"description": "Convert is an A/B testing platform. Their services offer A/B testing, split testing, multivariate testing, multipage testing, and personalizations.",
|
|
6
|
+
"logo": "https://cdn.metarouter.io/logo.svg",
|
|
7
|
+
"color": "#0b0e15",
|
|
8
|
+
"eventSource": {
|
|
9
|
+
"isAndroidApp": false,
|
|
10
|
+
"isIosApp": false,
|
|
11
|
+
"isWebApp": true
|
|
12
|
+
},
|
|
13
|
+
"inputSchema": "analytics_js",
|
|
14
|
+
"releaseNotes": [
|
|
15
|
+
{
|
|
16
|
+
"date": "2023-09-08T00:00:00.000Z",
|
|
17
|
+
"note": "Initial build."
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"2afa1b12dbc4c3fccd224b5d2988578f"
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "v0.0.1",
|
|
3
|
+
"params": [
|
|
4
|
+
{
|
|
5
|
+
"name": "ACCOUNT_ID",
|
|
6
|
+
"exampleValue": "my-account-id"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"name": "PROJECT_ID",
|
|
10
|
+
"exampleValue": "my-project-id"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"global": {
|
|
14
|
+
"filters": [
|
|
15
|
+
{
|
|
16
|
+
"byEventNames": {
|
|
17
|
+
"action": "deny",
|
|
18
|
+
"events": [
|
|
19
|
+
"screen"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"byConditions": {
|
|
25
|
+
"action": "allow",
|
|
26
|
+
"when": {
|
|
27
|
+
"inputPathExists": {
|
|
28
|
+
"inputPath": "context.providers.convert.conv_v"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"enrichments": [
|
|
35
|
+
{
|
|
36
|
+
"outputKey": "cid",
|
|
37
|
+
"staticString": "$$ACCOUNT_ID$$"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"outputKey": "pid",
|
|
41
|
+
"staticString": "$$PROJECT_ID$$"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"mappings": [
|
|
45
|
+
{
|
|
46
|
+
"inputKey": "input",
|
|
47
|
+
"outputKey": "seg.browser",
|
|
48
|
+
"transforms": [
|
|
49
|
+
{
|
|
50
|
+
"expression": {
|
|
51
|
+
"lang": "lua",
|
|
52
|
+
"body": "local userAgent = LOWER(input.context.userAgent)\nif string.find(userAgent, \"chrome\") then\n return \"CH\"\nelseif string.find(userAgent, \"edge\") then\n return \"IE\"\nelseif string.find(userAgent, \"safari\") then\n return \"SF\"\nelseif string.find(userAgent, \"firefox\") then\n return \"FF\"\nelseif string.find(userAgent, \"opera\") then\n return \"OP\"\nelse\n return \"OTH\"\nend"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"inputKey": "input",
|
|
59
|
+
"outputKey": "seg.devices",
|
|
60
|
+
"transforms": [
|
|
61
|
+
{
|
|
62
|
+
"expression": {
|
|
63
|
+
"lang": "lua",
|
|
64
|
+
"body": "local type = LOWER(input.context.device.type)\nlocal t = {}\n if t == 'ios' then\n table.insert(t,\"IPAD\")\n elseif t == 'android' then\n table.insert(t,\"ALLTAB\")\n else\n table.insert(t,\"DESK\")\n end\n return t"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"inputKey": "input",
|
|
71
|
+
"outputKey": "seg.source",
|
|
72
|
+
"transforms": [
|
|
73
|
+
{
|
|
74
|
+
"expression": {
|
|
75
|
+
"lang": "lua",
|
|
76
|
+
"body": "local campaign = context.campaign.source\nreturn \"direct\""
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"inputKey": "input",
|
|
83
|
+
"outputKey": "seg.new",
|
|
84
|
+
"transforms": [
|
|
85
|
+
{
|
|
86
|
+
"expression": {
|
|
87
|
+
"lang": "lua",
|
|
88
|
+
"body": "local conv_v = input.context.providers.convert.conv_v\nif (conv_v) then\n -- Function to parse key-value pairs from a string\n local function parseKeyValuePairs(str)\n local result = {}\n for key, value in str:gmatch(\"(%w+):([%w%-{}%.]+)\") do\n result[key] = value\n end\n return result\n end\n -- Extract key-value pairs from the input string\n local extractedValues = parseKeyValuePairs(conv_v)\n\n if (TO_ROUNDED_INT(extractedValues[\"pv\"]) > 0) then\n return 1\n else\n return 0\n end\nend"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"inputKey": "input",
|
|
95
|
+
"outputKey": "seg.ctry",
|
|
96
|
+
"transforms": [
|
|
97
|
+
{
|
|
98
|
+
"expression": {
|
|
99
|
+
"lang": "lua",
|
|
100
|
+
"body": "if (input.context.location.country == \"United States\") then\n return \"US\"\nend\n--return TO_ISO_COUNTRY(\"United States\")"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"inputKey": "input",
|
|
107
|
+
"outputKey": "seg.cust",
|
|
108
|
+
"transforms": [
|
|
109
|
+
{
|
|
110
|
+
"expression": {
|
|
111
|
+
"lang": "lua",
|
|
112
|
+
"body": "local conv_v = input.context.providers.convert.conv_v\n\nif (conv_v) then\n -- Function to parse key-value pairs from a string\n local function parseKeyValuePairs(str)\n local result = {}\n for key, value in str:gmatch(\"(%w+):([%w%-{}%.]+)\") do\n result[key] = value\n end\n return result\n end\n\n -- Extract key-value pairs from the input string\n local extractedValues = parseKeyValuePairs(conv_v)\n\n if extractedValues[\"seg\"] then\n -- Handle nested values within \"seg\"\n local segValue = extractedValues[\"seg\"]\n local segArray = {}\n\n -- Extract individual segments by splitting at '-'\n for segment in segValue:gmatch(\"([^%-]+)\") do\n -- Remove curly brackets from each segment\n segment = segment:gsub(\"[%{%}]\", \"\")\n table.insert(segArray, segment)\n end\n\n return segArray\n end\nend"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"inputKey": "messageId",
|
|
119
|
+
"outputKey": "vid"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"default": {
|
|
124
|
+
"mappings": [
|
|
125
|
+
{
|
|
126
|
+
"inputKey": "input",
|
|
127
|
+
"outputKey": "ev",
|
|
128
|
+
"transforms": [
|
|
129
|
+
{
|
|
130
|
+
"expression": {
|
|
131
|
+
"lang": "lua",
|
|
132
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"eventSpecific": {
|
|
140
|
+
"cart_viewed": {
|
|
141
|
+
"mappings": [
|
|
142
|
+
{
|
|
143
|
+
"inputKey": "input",
|
|
144
|
+
"outputKey": "ev",
|
|
145
|
+
"transforms": [
|
|
146
|
+
{
|
|
147
|
+
"expression": {
|
|
148
|
+
"lang": "lua",
|
|
149
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
"checkout_started": {
|
|
157
|
+
"mappings": [
|
|
158
|
+
{
|
|
159
|
+
"inputKey": "input",
|
|
160
|
+
"outputKey": "ev",
|
|
161
|
+
"transforms": [
|
|
162
|
+
{
|
|
163
|
+
"expression": {
|
|
164
|
+
"lang": "lua",
|
|
165
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"identify": {
|
|
173
|
+
"mappings": [
|
|
174
|
+
{
|
|
175
|
+
"inputKey": "input",
|
|
176
|
+
"outputKey": "ev",
|
|
177
|
+
"transforms": [
|
|
178
|
+
{
|
|
179
|
+
"expression": {
|
|
180
|
+
"lang": "lua",
|
|
181
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
"order_completed": {
|
|
189
|
+
"mappings": [
|
|
190
|
+
{
|
|
191
|
+
"inputKey": "input",
|
|
192
|
+
"outputKey": "ev",
|
|
193
|
+
"transforms": [
|
|
194
|
+
{
|
|
195
|
+
"expression": {
|
|
196
|
+
"lang": "lua",
|
|
197
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\",\"tr\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"page": {
|
|
205
|
+
"mappings": [
|
|
206
|
+
{
|
|
207
|
+
"inputKey": "input",
|
|
208
|
+
"outputKey": "ev",
|
|
209
|
+
"transforms": [
|
|
210
|
+
{
|
|
211
|
+
"expression": {
|
|
212
|
+
"lang": "lua",
|
|
213
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
"payment_info_entered": {
|
|
221
|
+
"mappings": [
|
|
222
|
+
{
|
|
223
|
+
"inputKey": "input",
|
|
224
|
+
"outputKey": "ev",
|
|
225
|
+
"transforms": [
|
|
226
|
+
{
|
|
227
|
+
"expression": {
|
|
228
|
+
"lang": "lua",
|
|
229
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"product_added": {
|
|
237
|
+
"mappings": [
|
|
238
|
+
{
|
|
239
|
+
"inputKey": "input",
|
|
240
|
+
"outputKey": "ev",
|
|
241
|
+
"transforms": [
|
|
242
|
+
{
|
|
243
|
+
"expression": {
|
|
244
|
+
"lang": "lua",
|
|
245
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
"product_list_viewed": {
|
|
253
|
+
"mappings": [
|
|
254
|
+
{
|
|
255
|
+
"inputKey": "input",
|
|
256
|
+
"outputKey": "ev",
|
|
257
|
+
"transforms": [
|
|
258
|
+
{
|
|
259
|
+
"expression": {
|
|
260
|
+
"lang": "lua",
|
|
261
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
"product_viewed": {
|
|
269
|
+
"mappings": [
|
|
270
|
+
{
|
|
271
|
+
"inputKey": "input",
|
|
272
|
+
"outputKey": "ev",
|
|
273
|
+
"transforms": [
|
|
274
|
+
{
|
|
275
|
+
"expression": {
|
|
276
|
+
"lang": "lua",
|
|
277
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
]
|
|
283
|
+
},
|
|
284
|
+
"products_searched": {
|
|
285
|
+
"mappings": [
|
|
286
|
+
{
|
|
287
|
+
"inputKey": "input",
|
|
288
|
+
"outputKey": "ev",
|
|
289
|
+
"transforms": [
|
|
290
|
+
{
|
|
291
|
+
"expression": {
|
|
292
|
+
"lang": "lua",
|
|
293
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
"promotion_clicked": {
|
|
301
|
+
"mappings": [
|
|
302
|
+
{
|
|
303
|
+
"inputKey": "input",
|
|
304
|
+
"outputKey": "ev",
|
|
305
|
+
"transforms": [
|
|
306
|
+
{
|
|
307
|
+
"expression": {
|
|
308
|
+
"lang": "lua",
|
|
309
|
+
"body": "--modify eventTypes to specifcy the event type sent to Convert. For example {\"hitGoal\"} to send just hitGoal, {\"hitGoal\", \"tr\"} to send both hitGoal and tr\nlocal eventTypes = {\"hitGoal\"}\nlocal inputString = input.context.providers.convert.conv_v\n\n-- Initialize a table to store all events\nlocal allEvents = {}\n\nfor i = 1, #eventTypes do\n local eventType = eventTypes[i]\n if inputString then\n inputString = inputString:gsub(\"-\", \",\"):gsub(\"%.\", \":\"):gsub(\n \"([a-z0-9]+):\", '\"%1\":'\n )\n\n -- Iterate through the inputString to extract values\n for expValue, vValue, gValue in inputString:gmatch(\n \"\\\"(%d+)\\\":%s*{\\\"v\\\":(%d+),\\\"g\\\":{([^}]*)}}\"\n ) do\n local goals = {}\n for goal in gValue:gmatch(\"(%d+%.?%d*)\") do\n if goal ~= \"1\" then\n table.insert(goals, goal)\n end\n end\n\n vValue = vValue:gsub(\":1\", \"\")\n\n local event = {\n evt = eventType,\n goals = goals,\n vars = {vValue},\n exps = {expValue},\n }\n\n if eventType == \"tr\" then\n event.r = input.properties.total or 0\n event.prc = SUM(MAP(input.properties.products, function(p)\n return p.quantity or 0\n end))\n end\n\n -- Add the event directly to the allEvents table\n table.insert(allEvents, event)\n end\n end\nend\n\n-- Return all accumulated events in a single array\nreturn allEvents"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
package/index.js
CHANGED
|
@@ -110,6 +110,13 @@ exports.braze = {
|
|
|
110
110
|
metadata: require('./.dist/braze/metadata.json')
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
exports.convert = {
|
|
114
|
+
connectionTemplate: connectionSchemas.properties.convert,
|
|
115
|
+
endpointSchema: require('./.dist/convert/connection.json'),
|
|
116
|
+
playbook: require('./.dist/convert/playbook.json'),
|
|
117
|
+
metadata: require('./.dist/convert/metadata.json')
|
|
118
|
+
},
|
|
119
|
+
|
|
113
120
|
exports.criteo = {
|
|
114
121
|
connectionTemplate: connectionSchemas.properties.criteo,
|
|
115
122
|
endpointSchema: require('./.dist/criteo/connection.json'),
|
|
@@ -497,6 +504,11 @@ exports.etags = {
|
|
|
497
504
|
playbook: require('./.dist/braze/playbook.etag.json'),
|
|
498
505
|
kit: require('./.dist/braze/kit.etag.json')
|
|
499
506
|
},
|
|
507
|
+
convert: {
|
|
508
|
+
endpointSchema: require('./.dist/convert/connection.etag.json'),
|
|
509
|
+
playbook: require('./.dist/convert/playbook.etag.json'),
|
|
510
|
+
kit: require('./.dist/convert/kit.etag.json')
|
|
511
|
+
},
|
|
500
512
|
criteo: {
|
|
501
513
|
endpointSchema: require('./.dist/criteo/connection.etag.json'),
|
|
502
514
|
playbook: require('./.dist/criteo/playbook.etag.json'),
|