@metarouter/ajs-starter-kit 1.0.70 → 1.0.72

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.
@@ -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
+ }
@@ -1 +1 @@
1
- "c0f1ae5b49b9dfcd4543bb181ead9c4f"
1
+ "e9d4a0b957a700a9e5e7527a9ab3856a"
@@ -15,6 +15,10 @@
15
15
  {
16
16
  "date": "2023-07-04T00:00:00.000Z",
17
17
  "note": "Google Ads initial release."
18
+ },
19
+ {
20
+ "date": "2023-09-12T00:00:00.000Z",
21
+ "note": "Bug fixing the `gclid` value\nReplace params usage for conversion action IDs"
18
22
  }
19
23
  ]
20
24
  }
@@ -1 +1 @@
1
- "784aa57838afc393f56535fc586b8dae"
1
+ "11ff4e34a02203e6cbe54646441ea36d"
@@ -4,14 +4,6 @@
4
4
  {
5
5
  "name": "CUSTOMER_ID",
6
6
  "exampleValue": "customer-id"
7
- },
8
- {
9
- "name": "PAGE_CONVERSION_ACTION",
10
- "defaultValue": "page-conversion-action"
11
- },
12
- {
13
- "name": "ORDER_COMPLETED_CONVERSION_ACTION",
14
- "defaultValue": "order-completed-conversion-action"
15
7
  }
16
8
  ],
17
9
  "default": {
@@ -48,7 +40,15 @@
48
40
  "mappings": [
49
41
  {
50
42
  "inputKey": "context.providers.googleGtag.data.gclid",
51
- "outputKey": "gclid"
43
+ "outputKey": "gclid",
44
+ "transforms": [
45
+ {
46
+ "expression": {
47
+ "lang": "lua",
48
+ "body": "if input.context.providers.googleGtag.data.gclid then\n return SPLIT(input.context.providers.googleGtag.data.gclid, \".\",3)[3]\nend"
49
+ }
50
+ }
51
+ ]
52
52
  },
53
53
  {
54
54
  "inputKey": "input",
@@ -91,7 +91,7 @@
91
91
  "transforms": [
92
92
  {
93
93
  "expression": {
94
- "body": "return \"customers/$$CUSTOMER_ID$$/conversionActions/$$PAGE_CONVERSION_ACTION$$\"",
94
+ "body": "return \"customers/$$CUSTOMER_ID$$/conversionActions/ADD_CONVERSION_ACTION_ID_HERE\"",
95
95
  "lang": "lua"
96
96
  }
97
97
  }
@@ -107,7 +107,7 @@
107
107
  "transforms": [
108
108
  {
109
109
  "expression": {
110
- "body": "return \"customers/$$CUSTOMER_ID$$/conversionActions/$$ORDER_COMPLETED_CONVERSION_ACTION$$\"",
110
+ "body": "return \"customers/$$CUSTOMER_ID$$/conversionActions/ADD_CONVERSION_ACTION_ID_HERE\"",
111
111
  "lang": "lua"
112
112
  }
113
113
  }
@@ -1 +1 @@
1
- "9bfd4da26c3cf35f3a0d1b8aaab801ff"
1
+ "05fbbb7990c0e0d235d4a1b116a6bdf0"
@@ -1,5 +1,5 @@
1
1
  {
2
- "isDraft": false,
2
+ "isDraft": true,
3
3
  "isBeta": false,
4
4
  "friendlyName": "Media Math",
5
5
  "description": "Media Math give marketers the tools to execute smart marketing at scale and to drive truly incremental business value.",
@@ -18,11 +18,15 @@
18
18
  },
19
19
  {
20
20
  "date": "2021-06-28T00:00:00.000Z",
21
- "note": "Setting isDraft to false"
21
+ "note": "Setting `isDraft` to `false`."
22
22
  },
23
23
  {
24
24
  "date": "2022-11-16T00:00:00.000Z",
25
- "note": "Add isBeta field"
25
+ "note": "Add `isBeta` field."
26
+ },
27
+ {
28
+ "date": "2023-09-12T00:00:00.000Z",
29
+ "note": "Hide kit from the UI by setting `isDraft` to `true`."
26
30
  }
27
31
  ]
28
32
  }
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,10 @@ 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
+ playbook: require('./.dist/convert/playbook.etag.json'),
509
+ kit: require('./.dist/convert/kit.etag.json')
510
+ },
500
511
  criteo: {
501
512
  endpointSchema: require('./.dist/criteo/connection.etag.json'),
502
513
  playbook: require('./.dist/criteo/playbook.etag.json'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metarouter/ajs-starter-kit",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "MetaRouter analytics.js starter kit",
5
5
  "main": "index.js",
6
6
  "scripts": {