@metarouter/ajs-starter-kit 1.0.82-alpha.2 → 1.0.83

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.
@@ -1 +1 @@
1
- "0c471d1504392504e2bfca3a657124c9"
1
+ "526713ff0a5f473df5c1dc0426ed3f3e"
@@ -1,6 +1,41 @@
1
1
  {
2
+ "params": [
3
+ {
4
+ "name": "FIRST_PARTY_DOMAIN",
5
+ "exampleValue": "www.metarouter.io",
6
+ "description": "The domain of the partner. for www.fnac.com, it could be “fnac.com” or “www.fnac.com”…. this parameter is used to avoid id collisions on two different websites. Collisions are unlikely to happen if the GUID is correctly generated.",
7
+ "isOptional": false
8
+ },
9
+ {
10
+ "name": "FIRST_PARTY_NAME",
11
+ "exampleValue": "www.metarouter.io",
12
+ "description": "Advertiser name.",
13
+ "isOptional": false
14
+ },
15
+ {
16
+ "name": "PARTNER_ID",
17
+ "exampleValue": "my-partner-id",
18
+ "description": "The partner ID of the account you are sending the data to. Please reach out to your Criteo representative if you do not have this value.",
19
+ "isOptional": false
20
+ }
21
+ ],
2
22
  "default": {
3
- "endpoint": "http://widget.criteo.com/m/event?version=s2s_v0",
4
- "method": "POST"
23
+ "endpoint": "https://sslwidget.criteo.com/fpm/event",
24
+ "transform": {
25
+ "lang": "lua",
26
+ "body": "local retailer_visitor_id = batch[1].retailer_visitor_id\nrequest.url = request.url ..\"?first_party_id=\".. retailer_visitor_id\nrequest.url = request.url ..\"&first_party_domain=\" .. \"$$FIRST_PARTY_DOMAIN$$\"\nrequest.url = request.url ..\"&first_party_name=\" .. \"$$FIRST_PARTY_NAME$$\"\nrequest.url = request.url ..\"&p=\" .. \"$$PARTNER_ID$$\"\nreturn request"
27
+ },
28
+ "method": "POST",
29
+ "batchSize": 1,
30
+ "headers": [
31
+ {
32
+ "key": "Content-Type",
33
+ "value": "application/json"
34
+ },
35
+ {
36
+ "key": "Accept-Encoding",
37
+ "value": "json"
38
+ }
39
+ ]
5
40
  }
6
41
  }
@@ -1 +1 @@
1
- "1419e74b9efaa9436da1b88aa4425713"
1
+ "11cef502ce31e460d7b55996697bfe0a"
@@ -2,12 +2,12 @@
2
2
  "isDraft": false,
3
3
  "isBeta": true,
4
4
  "friendlyName": "Criteo",
5
- "description": "With our holistic suite of advertising solutions, retailers, brands, and publishers of all sizes can access the data\nand technology they need to best attract and keep their customers.",
6
- "logo": "https://cdn.metarouter.io/logo.svg",
7
- "color": "#F37822",
5
+ "description": "Criteo is a Commerce Media Platform that offers programmatic advertising solutions.",
6
+ "logo": "https://cdn.metarouter.io/criteo.png",
7
+ "color": "#f55615",
8
8
  "eventSource": {
9
- "isAndroidApp": true,
10
- "isIosApp": true,
9
+ "isAndroidApp": false,
10
+ "isIosApp": false,
11
11
  "isWebApp": true
12
12
  },
13
13
  "inputSchema": "analytics_js",
@@ -23,6 +23,10 @@
23
23
  {
24
24
  "date": "2023-12-13T00:00:00.000Z",
25
25
  "note": "Marked as unstable version: 0.1.0"
26
+ },
27
+ {
28
+ "date": "2024-03-06T05:00:00.000Z",
29
+ "note": "Migrated to Server to Server endpoint"
26
30
  }
27
31
  ]
28
32
  }
@@ -1 +1 @@
1
- "a2e0cf4a85eef88fd901b4cafb13b73d"
1
+ "cabe263814512a5000a1bdbdd8b00f9d"
@@ -1,60 +1,125 @@
1
1
  {
2
- "version": "0.1.0",
2
+ "version": "0.2.0",
3
3
  "params": [
4
4
  {
5
- "name": "ACCOUNT",
6
- "exampleValue": "my-account"
7
- },
8
- {
9
- "name": "MAPPING_KEY",
10
- "exampleValue": "my-mapping-key"
5
+ "name": "PARTNER_ID",
6
+ "exampleValue": "my-partner-id",
7
+ "description": "The partner ID of the account you are sending the data to. Please reach out to your Criteo representative if you do not have this value.",
8
+ "isOptional": false
11
9
  }
12
10
  ],
13
11
  "global": {
14
12
  "enrichments": [
15
13
  {
16
- "staticString": "$$ACCOUNT$$",
14
+ "staticString": "$$PARTNER_ID$$",
17
15
  "outputKey": "account"
18
16
  },
19
17
  {
20
18
  "staticString": "d",
21
19
  "outputKey": "site_type"
22
- },
23
- {
24
- "staticInt": 1,
25
- "outputKey": "deduplication"
26
- },
27
- {
28
- "staticString": "$$MAPPING_KEY$$",
29
- "outputKey": "id.mapping_key"
30
20
  }
31
21
  ],
32
22
  "mappings": [
23
+ {
24
+ "inputKey": "anonymousId",
25
+ "outputKey": "retailer_visitor_id"
26
+ },
33
27
  {
34
28
  "inputKey": "context.ip",
35
29
  "outputKey": "ip"
36
30
  },
37
31
  {
38
- "inputKey": "context.providers.criteo.userId",
39
- "outputKey": "id.mapped_user_id"
32
+ "inputKey": "context.page.url",
33
+ "outputKey": "full_url"
34
+ },
35
+ {
36
+ "inputKey": "context.page.title",
37
+ "outputKey": "page_title"
38
+ },
39
+ {
40
+ "inputKey": "context.userAgent",
41
+ "outputKey": "user_agent"
42
+ },
43
+ {
44
+ "inputKey": "input",
45
+ "outputKey": "id.email.raw",
46
+ "transforms": [
47
+ {
48
+ "expression": {
49
+ "lang": "lua",
50
+ "body": "return LOWER(TRIM(input.traits.email))"
51
+ }
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ "inputKey": "traits.email",
57
+ "outputKey": "id.email.sha256_md5",
58
+ "transforms": [
59
+ {
60
+ "expression": {
61
+ "lang": "lua",
62
+ "body": "return TO_SHA256_HASH(TO_MD5_HASH(LOWER(TRIM(input.traits.email))))"
63
+ }
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ "inputKey": "input",
69
+ "outputKey": "id.email.md5",
70
+ "transforms": [
71
+ {
72
+ "expression": {
73
+ "lang": "lua",
74
+ "body": "return TO_MD5_HASH(LOWER(TRIM(input.traits.email)))"
75
+ }
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "inputKey": "input",
81
+ "outputKey": "id.email.sha256",
82
+ "transforms": [
83
+ {
84
+ "expression": {
85
+ "lang": "lua",
86
+ "body": "return TO_SHA256_HASH(LOWER(TRIM(input.traits.email)))"
87
+ }
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ "inputKey": "timestamp",
93
+ "outputKey": "events.timestamp",
94
+ "transforms": [
95
+ {
96
+ "toDateTime": {
97
+ "inputFormat": "2006-01-02T15:04:05Z07:00",
98
+ "outputFormat": "2006-01-02T15:04:05Z07:00"
99
+ }
100
+ }
101
+ ]
40
102
  }
41
103
  ]
42
104
  },
43
105
  "eventSpecific": {
44
- "page": {
45
- "filters": [
46
- {
47
- "byConditions": {
48
- "action": "allow",
49
- "when": {
50
- "stringEqual": {
51
- "inputPath": "context.page.path",
52
- "value": "/"
106
+ "product_list_viewed": {
107
+ "mappings": [
108
+ {
109
+ "inputKey": "input",
110
+ "outputKey": "events",
111
+ "transforms": [
112
+ {
113
+ "expression": {
114
+ "lang": "lua",
115
+ "body": "local event = {\n {\n event = \"viewList\",\n currency = UPPER(input.properties.currency),\n item = {}\n }\n}\n\n-- returns an array of the top 3 products on the listing page a user visited.\nfor i, product in ipairs(input.properties.products) do\n if i <= 3 then\n table.insert(event[1].item, {id = product.product_id})\n else\n break\n end\nend\nreturn event"
53
116
  }
54
117
  }
55
- }
118
+ ]
56
119
  }
57
- ],
120
+ ]
121
+ },
122
+ "cart_viewed": {
58
123
  "mappings": [
59
124
  {
60
125
  "inputKey": "input",
@@ -63,26 +128,43 @@
63
128
  {
64
129
  "expression": {
65
130
  "lang": "lua",
66
- "body": "return {{\n event = 'viewHome',\n ua_raw_string = input.context.userAgent or '',\n}}"
131
+ "body": "local event = {{\nevent = \"viewBasket\",\ncurrency = UPPER(input.properties.currency),\n item = MAP(\n input.properties.products,\n function (p)\n return {\n id=p.product_id,\n price = p.price,\n category = p.category,\n quantity = p.quantity\n }\n end\n )\n}}\nreturn event"
67
132
  }
68
133
  }
69
134
  ]
70
135
  }
71
136
  ]
72
137
  },
73
- "product_list_viewed": {
74
- "filters": [
138
+ "order_completed": {
139
+ "mappings": [
75
140
  {
76
- "byConditions": {
77
- "action": "allow",
78
- "when": {
79
- "inputPathIsObject": {
80
- "inputPath": "properties.products.0"
141
+ "inputKey": "properties.currency",
142
+ "outputKey": "events.currency",
143
+ "transforms": [
144
+ {
145
+ "modifyString": "uppercase"
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "inputKey": "properties.order_id",
151
+ "outputKey": "events.order_id"
152
+ },
153
+ {
154
+ "inputKey": "input",
155
+ "outputKey": "events",
156
+ "transforms": [
157
+ {
158
+ "expression": {
159
+ "lang": "lua",
160
+ "body": "local event = {{\n event = \"trackTransaction\",\n timestamp = TO_DATE_TIME(input.timestamp, { inputFormat = \"2006-01-02T15:04:05Z07:00\" }),\n id = input.properties.order_id,\n currency = UPPER(input.properties.currency),\n item = MAP(\n input.properties.products,\n function (p)\n return {\n id=p.product_id,\n price = p.price,\n quantity = p.quantity\n }\n end\n )\n }}\n return event"
81
161
  }
82
162
  }
83
- }
163
+ ]
84
164
  }
85
- ],
165
+ ]
166
+ },
167
+ "product_added": {
86
168
  "mappings": [
87
169
  {
88
170
  "inputKey": "input",
@@ -91,7 +173,7 @@
91
173
  {
92
174
  "expression": {
93
175
  "lang": "lua",
94
- "body": "return {{\n event = 'viewList',\n ua_raw_string = input.context.userAgent or '',\n item = PLUCK(input.properties.products, \"product_id\"),\n}}"
176
+ "body": "local event = {{\nevent = \"addToCart\",\ntimestamp = TO_DATE_TIME(input.timestamp, { inputFormat = \"2006-01-02T15:04:05Z07:00\" }),\ncurrency = UPPER(input.properties.currency),\n item ={{\n id=input.properties.product_id,\n price = input.properties.price,\n quantity = input.properties.quantity\n }}\n}}\nreturn event"
95
177
  }
96
178
  }
97
179
  ]
@@ -99,19 +181,32 @@
99
181
  ]
100
182
  },
101
183
  "product_viewed": {
102
- "filters": [
103
- {
104
- "byConditions": {
105
- "action": "allow",
106
- "when": {
107
- "stringNotEqual": {
108
- "inputPath": "properties.product_id",
109
- "value": ""
184
+ "enrichments": [
185
+ {
186
+ "staticString": "viewItem",
187
+ "outputKey": "events.event"
188
+ }
189
+ ],
190
+ "mappings": [
191
+ {
192
+ "inputKey": "properties.product_id",
193
+ "outputKey": "events.item"
194
+ },
195
+ {
196
+ "inputKey": "timestamp",
197
+ "outputKey": "events.timestamp",
198
+ "transforms": [
199
+ {
200
+ "toDateTime": {
201
+ "inputFormat": "2006-01-02T15:04:05Z07:00",
202
+ "outputFormat": "2006-01-02T15:04:05Z07:00"
110
203
  }
111
204
  }
112
- }
205
+ ]
113
206
  }
114
- ],
207
+ ]
208
+ },
209
+ "products_searched": {
115
210
  "mappings": [
116
211
  {
117
212
  "inputKey": "input",
@@ -120,27 +215,36 @@
120
215
  {
121
216
  "expression": {
122
217
  "lang": "lua",
123
- "body": "return {{\n event = 'viewItem',\n ua_raw_string = input.context.userAgent or '',\n item = input.properties.product_id,\n}}"
218
+ "body": "local event = {{\nevent = \"viewList\",\ntimestamp = TO_DATE_TIME(input.timestamp, { inputFormat = \"2006-01-02T15:04:05Z07:00\" }),\ncategory = input.properties.category,\nkeyword = input.properties.query,\n item ={{\n id=input.properties.product_id,\n price = input.properties.price,\n quantity = input.properties.quantity\n }}\n}}\nreturn event"
124
219
  }
125
220
  }
126
221
  ]
127
222
  }
128
223
  ]
129
224
  },
130
- "cart_viewed": {
131
- "filters": [
225
+ "payment_info_entered": {
226
+ "enrichments": [
132
227
  {
133
- "byConditions": {
134
- "action": "allow",
135
- "when": {
136
- "inputPathIsObject": {
137
- "inputPath": "properties.products.0"
138
- }
139
- }
140
- }
228
+ "staticString": "addPaymentInfo",
229
+ "outputKey": "events.event"
141
230
  }
142
- ],
231
+ ]
232
+ },
233
+ "checkout_started": {
143
234
  "mappings": [
235
+ {
236
+ "inputKey": "properties.currency",
237
+ "outputKey": "events.currency",
238
+ "transforms": [
239
+ {
240
+ "modifyString": "uppercase"
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ "inputKey": "properties.order_id",
246
+ "outputKey": "events.id"
247
+ },
144
248
  {
145
249
  "inputKey": "input",
146
250
  "outputKey": "events",
@@ -148,35 +252,31 @@
148
252
  {
149
253
  "expression": {
150
254
  "lang": "lua",
151
- "body": "local items = MAP(\n input.properties.products,\n function (p)\n return {\n id = p.product_id,\n price = TO_FLOAT(p.price),\n quantity = TO_FLOAT(p.quantity or 1)\n }\n end\n )\nreturn {{\n event = 'viewBasket',\n ua_raw_string = input.context.userAgent or '',\n item = items,\n}}"
255
+ "body": "local event = {{\nevent = \"beginCheckout\",\ntimestamp = TO_DATE_TIME(input.timestamp, { inputFormat = \"2006-01-02T15:04:05Z07:00\" }),\ncurrency = UPPER(input.properties.currency),\n item = MAP(\n input.properties.products,\n function (p)\n return {\n id=p.product_id,\n price = p.price,\n quantity = p.quantity\n }\n end\n )\n}}\nreturn event"
152
256
  }
153
257
  }
154
258
  ]
155
259
  }
156
260
  ]
157
261
  },
158
- "order_completed": {
159
- "filters": [
262
+ "identify": {
263
+ "enrichments": [
160
264
  {
161
- "byConditions": {
162
- "action": "allow",
163
- "when": {
164
- "inputPathIsObject": {
165
- "inputPath": "properties.products.0"
166
- }
167
- }
168
- }
265
+ "staticString": "login",
266
+ "outputKey": "events.event"
169
267
  }
170
- ],
268
+ ]
269
+ },
270
+ "page": {
171
271
  "mappings": [
172
272
  {
173
273
  "inputKey": "input",
174
- "outputKey": "events",
274
+ "outputKey": "events.event",
175
275
  "transforms": [
176
276
  {
177
277
  "expression": {
178
278
  "lang": "lua",
179
- "body": "local items = MAP(\n input.properties.products,\n function (p)\n return {\n id = p.product_id,\n price = TO_FLOAT(p.price),\n quantity = TO_FLOAT(p.quantity or 1)\n }\n end\n )\n return {{\n event = 'trackTransaction',\n ua_raw_string = input.context.userAgent or '',\n id = input.properties.order_id,\n item = items,\n currency = UPPER(input.properties.currency),\n }}"
279
+ "body": "return (input.context.page.path == \"/\" and \"viewHome\") or \"viewPage\""
180
280
  }
181
281
  }
182
282
  ]
package/README.md CHANGED
@@ -5,6 +5,9 @@ event methods, you will create a rich, actionable data set from your website, mo
5
5
  server, and other sources. It is particularly useful for tracking the pages or screens your
6
6
  users visit, the actions they take on your property, and whether the user has been identified
7
7
  previously.
8
+ ## 2024-03
9
+ - Criteo (BETA)
10
+
8
11
  ## 2024-02
9
12
  - Azure Blob
10
13
  - Commission Junction (BETA)
@@ -35,7 +38,6 @@ previously.
35
38
  - Blueshift (BETA)
36
39
  - Braze
37
40
  - Convert (BETA)
38
- - Criteo (BETA)
39
41
  - Customer.io
40
42
  - Facebook Pixel
41
43
  - Google Ads (BETA)
@@ -75,6 +77,7 @@ previously.
75
77
 
76
78
  | Kit Name | Date | Latest Note |
77
79
  |----------|------|-------------|
80
+ | Criteo (BETA) | 2024-03 | Migrated to Server to Server endpoint |
78
81
  | Azure Blob | 2024-02 | Removed Identity |
79
82
  | Commission Junction (BETA) | 2024-02 | Add order_canceled and order_updated. |
80
83
  | Google Cloud Storage (BETA) | 2024-02 | Removed Identity |
@@ -100,7 +103,6 @@ previously.
100
103
  | Blueshift (BETA) | 2023-12 | Marked as unstable version: 0.1.0 |
101
104
  | Braze | 2023-12 | Marked as stable version: 1.0.0 |
102
105
  | Convert (BETA) | 2023-12 | Marked as unstable version: 0.1.0 |
103
- | Criteo (BETA) | 2023-12 | Marked as unstable version: 0.1.0 |
104
106
  | Customer.io | 2023-12 | Marked as stable version: 1.0.0 |
105
107
  | Facebook Pixel | 2023-12 | Marked as stable version: 1.0.0 |
106
108
  | Google Ads (BETA) | 2023-12 | Marked as unstable version: 0.1.0 |
package/index.js CHANGED
@@ -121,15 +121,14 @@ exports.convert = {
121
121
  endpointSchema: require('./.dist/criteo/connection.json'),
122
122
  playbook: require('./.dist/criteo/playbook.json'),
123
123
  metadata: require('./.dist/criteo/metadata.json')
124
+ },
125
+ exports['customer-io'] = {
126
+ connectionTemplate: connectionSchemas.properties.customerIo,
127
+ endpointSchema: require('./.dist/customer-io/connection.json'),
128
+ playbook: require('./.dist/customer-io/playbook.json'),
129
+ metadata: require('./.dist/customer-io/metadata.json')
124
130
  }
125
131
 
126
- exports['customer-io'] = {
127
- connectionTemplate: connectionSchemas.properties.customerIo,
128
- endpointSchema: require('./.dist/customer-io/connection.json'),
129
- playbook: require('./.dist/customer-io/playbook.json'),
130
- metadata: require('./.dist/customer-io/metadata.json')
131
- }
132
-
133
132
  exports['facebook-pixel'] = {
134
133
  connectionTemplate: connectionSchemas.properties.facebookPixel,
135
134
  endpointSchema: require('./.dist/facebook-pixel/connection.json'),
@@ -525,7 +524,7 @@ exports.etags = {
525
524
  playbook: require('./.dist/convert/playbook.etag.json'),
526
525
  kit: require('./.dist/convert/kit.etag.json')
527
526
  },
528
- 'commission-junction': {
527
+ 'commission-junction': {
529
528
  endpointSchema: require('./.dist/commission-junction/connection.etag.json'),
530
529
  playbook: require('./.dist/commission-junction/playbook.etag.json'),
531
530
  kit: require('./.dist/commission-junction/kit.etag.json')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metarouter/ajs-starter-kit",
3
- "version": "1.0.82-alpha.2",
3
+ "version": "1.0.83",
4
4
  "description": "MetaRouter analytics.js starter kit",
5
5
  "main": "index.js",
6
6
  "scripts": {