@metarouter/ajs-starter-kit 1.0.114 → 1.0.116

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
- "549fba66b298f359f67ef1e9b3d79de4"
1
+ "ca9087f7bf076105bb108cd41fc5f66d"
@@ -44,6 +44,10 @@
44
44
  {
45
45
  "date": "2024-10-23T00:00:00.000Z",
46
46
  "note": "Version: 0.3.0\nAdded header `Accept-Encoding: application/json`"
47
+ },
48
+ {
49
+ "date": "2024-12-18T00:00:00.000Z",
50
+ "note": "Version: 0.4.0\nChanged birthday mapping for identify event."
47
51
  }
48
52
  ]
49
53
  }
@@ -1 +1 @@
1
- "d9ac82e6fd92012765016571f92773d2"
1
+ "c25132d4e291fac5e5f9dcfd270fd929"
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.0",
2
+ "version": "0.4.0",
3
3
  "global": {
4
4
  "mappings": [
5
5
  {
@@ -127,36 +127,12 @@
127
127
  },
128
128
  {
129
129
  "inputKey": "input",
130
- "outputKey": "birth_year",
130
+ "outputKey": "birthday",
131
131
  "transforms": [
132
132
  {
133
133
  "expression": {
134
134
  "lang": "lua",
135
- "body": "local birthday = input.traits.birthday or input.context.traits.birthday\nif birthday then\n return tonumber(SPLIT(input.traits.birthday, \"-\", 1)[1])\nend"
136
- }
137
- }
138
- ]
139
- },
140
- {
141
- "inputKey": "input",
142
- "outputKey": "birth_month",
143
- "transforms": [
144
- {
145
- "expression": {
146
- "lang": "lua",
147
- "body": "local birthday = input.traits.birthday or input.context.traits.birthday\nif birthday then\n return tonumber(SPLIT(input.traits.birthday, \"-\", 2)[2])\nend"
148
- }
149
- }
150
- ]
151
- },
152
- {
153
- "inputKey": "input",
154
- "outputKey": "birth_dayofmonth",
155
- "transforms": [
156
- {
157
- "expression": {
158
- "lang": "lua",
159
- "body": "local birthday = input.traits.birthday or input.context.traits.birthday\nif birthday then\n return tonumber(SPLIT(SPLIT(input.traits.birthday, \"-\", 3)[3], \"T\", 1)[1])\nend"
135
+ "body": "local birthday = input.traits.birthday or input.context.traits.birthday\nif birthday then\n birthday = string.sub(birthday, 1, 10)\n return birthday\nend"
160
136
  }
161
137
  }
162
138
  ]
@@ -1 +1 @@
1
- "59c593668906cd0338bc2daf4588cc7d"
1
+ "9533e9757e3267ed08d51ae6c7257bce"
@@ -24,6 +24,10 @@
24
24
  {
25
25
  "date": "2024-10-23T00:00:00.000Z",
26
26
  "note": "Version: 0.3.0\nAdded header `Accept-Encoding: application/json`"
27
+ },
28
+ {
29
+ "date": "2024-12-18T00:00:00.000Z",
30
+ "note": "Version: 0.4.0\nAdded user property expression for anonymousId."
27
31
  }
28
32
  ]
29
33
  }
@@ -1 +1 @@
1
- "10d2fe3daf04389487e09912a621610b"
1
+ "a97907ef94eb10cff7a047317261221b"
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.0",
2
+ "version": "0.4.0",
3
3
  "global": {
4
4
  "mappings": [
5
5
  {
@@ -109,6 +109,12 @@
109
109
  "outputKey": "isDebugMode",
110
110
  "staticBool": false
111
111
  }
112
+ ],
113
+ "expressions": [
114
+ {
115
+ "body": "local up = {}\nup.metarouter_anonymousid = input.anonymousId\n\nlocal output = {} for key, value in pairs(up) do output[\"up.\" .. key] = value\nend\nreturn output",
116
+ "lang": "lua"
117
+ }
112
118
  ]
113
119
  },
114
120
  "params": [
@@ -1 +1 @@
1
- "89677e4943f3dbee7283caee60bd4930"
1
+ "2be528b0fe36e7efbe1b6751589975b9"
@@ -20,6 +20,10 @@
20
20
  {
21
21
  "date": "2024-12-04T22:00:00.000Z",
22
22
  "note": "Version: 0.2.0\nFixed time in milliseconds fidelity\nAdded `id` field"
23
+ },
24
+ {
25
+ "date": "2024-12-11T22:00:00.000Z",
26
+ "note": "Version: 0.3.0\nUpdated `page` events to Moloco's `HOME` or `PAGE_VIEW` event, based on `context.page.path`"
23
27
  }
24
28
  ]
25
29
  }
@@ -1 +1 @@
1
- "52742489d88988862b18ebc06b122088"
1
+ "508bb3db76f9d38bc1ec558c1a609676"
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.0",
2
+ "version": "0.3.0",
3
3
  "default": {
4
4
  "filters": [
5
5
  {
@@ -98,10 +98,18 @@
98
98
  },
99
99
  "eventSpecific": {
100
100
  "page": {
101
- "enrichments": [
101
+ "mappings": [
102
102
  {
103
+ "inputKey": "input",
103
104
  "outputKey": "event_type",
104
- "staticString": "PAGE_VIEW"
105
+ "transforms": [
106
+ {
107
+ "expression": {
108
+ "body": "if (input.context.page.path == '/') then return \"HOME\" end\nreturn \"PAGE_VIEW\"",
109
+ "lang": "lua"
110
+ }
111
+ }
112
+ ]
105
113
  }
106
114
  ]
107
115
  },
@@ -1 +1 @@
1
- "0cb388f22b4a349e7e01941fc6def3cc"
1
+ "fb8612861d40c9dd11f7e0f43b70c79a"
@@ -8,7 +8,7 @@
8
8
  }
9
9
  ],
10
10
  "default": {
11
- "endpoint": "https://$$DATA_CENTER$$.creativecdn.com/partner/omni/postbacks?",
11
+ "endpoint": "https://$$DATA_CENTER$$.creativecdn.com/partner/omni-metarouter/postbacks?",
12
12
  "method": "POST",
13
13
  "headers": [
14
14
  {
@@ -1 +1 @@
1
- "d5940b017b2555b325785b6b8a6f8d3c"
1
+ "27765902ba7cdd5037bed21d7998ce40"
@@ -20,6 +20,10 @@
20
20
  {
21
21
  "date": "2024-12-04T22:00:00.000Z",
22
22
  "note": "Version: 0.1.1\nFixed event name from `order-completed` to `order_completed`\nFixed time in milliseconds fidelity\nImproved order ID ensuring data type conversion to String"
23
+ },
24
+ {
25
+ "date": "2024-12-11T22:00:00.000Z",
26
+ "note": "Version: 0.2.1\nUpdated Endpoint URL\nAdded new fields for all events: page URL (`su`) and page referrer (`sr`)\nAdded new events: identify, page, products_searched, product_list_viewed, product_viewed, product_added, product_added_to_wishlist, cart_viewed, checkout_started"
23
27
  }
24
28
  ]
25
29
  }
@@ -1 +1 @@
1
- "f7f43c209a4997d1533957f33a41b003"
1
+ "4cd1e59e9ea075dcba3cbf572344b6f0"
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.1",
2
+ "version": "0.2.1",
3
3
  "params": [
4
4
  {
5
5
  "name": "PARTNER_KEY",
@@ -22,38 +22,194 @@
22
22
  }
23
23
  ]
24
24
  },
25
+ "global": {
26
+ "enrichments": [
27
+ {
28
+ "outputKey": "pkey",
29
+ "staticString": "$$PARTNER_KEY$$"
30
+ }
31
+ ],
32
+ "mappings": [
33
+ {
34
+ "inputKey": "anonymousId",
35
+ "outputKey": "aid"
36
+ },
37
+ {
38
+ "inputKey": "input",
39
+ "outputKey": "time",
40
+ "transforms": [
41
+ {
42
+ "expression": {
43
+ "body": "return MILLISECONDS_SINCE_EPOCH_FROM_RFC3999(input.timestamp or input.originalTimestamp or input.sentAt)",
44
+ "lang": "lua"
45
+ }
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "inputKey": "input",
51
+ "outputKey": "su",
52
+ "transforms": [
53
+ {
54
+ "expression": {
55
+ "lang": "lua",
56
+ "body": "local function encodeURIComponent(url)\n if url == nil then return end\n url = url:gsub(\"[^%w%-_%.!~%*'%(%)]\", function(c) return string.format(\"%%%02X\", string.byte(c)) end)\n return url\nend\nreturn encodeURIComponent(input.context.page.url)"
57
+ }
58
+ }
59
+ ]
60
+ },
61
+ {
62
+ "inputKey": "input",
63
+ "outputKey": "sr",
64
+ "transforms": [
65
+ {
66
+ "expression": {
67
+ "lang": "lua",
68
+ "body": "local function encodeURIComponent(url)\n if url == nil then return end\n url = url:gsub(\"[^%w%-_%.!~%*'%(%)]\", function(c) return string.format(\"%%%02X\", string.byte(c)) end)\n return url\nend\nreturn encodeURIComponent(input.context.page.referrer)"
69
+ }
70
+ }
71
+ ]
72
+ }
73
+ ]
74
+ },
25
75
  "eventSpecific": {
26
- "order_completed": {
76
+ "identify": {
77
+ "mappings": [
78
+ {
79
+ "inputKey": "input",
80
+ "outputKey": "tag",
81
+ "transforms": [
82
+ {
83
+ "expression": {
84
+ "body": "local pii = input.traits.email or input.context.traits.email or input.traits.phone or input.context.traits.phone\nlocal identifyDetails = \"\"\nif (pii) then identifyDetails = TO_SHA256_HASH(LOWER(TRIM(pii))) end\nreturn JOIN({\n 'pr_$$TAGGING_HASH$$',\n 'uid',\n identifyDetails\n}, '_')",
85
+ "lang": "lua"
86
+ }
87
+ }
88
+ ]
89
+ }
90
+ ]
91
+ },
92
+ "page": {
93
+ "mappings": [
94
+ {
95
+ "inputKey": "input",
96
+ "outputKey": "tag",
97
+ "transforms": [
98
+ {
99
+ "expression": {
100
+ "body": "local tag = \"\"\nif (input.context.page.path == '/') then tag = \"home\" end\nreturn JOIN({\n 'pr_$$TAGGING_HASH$$',\n tag\n}, '_')",
101
+ "lang": "lua"
102
+ }
103
+ }
104
+ ]
105
+ }
106
+ ]
107
+ },
108
+ "products_searched": {
27
109
  "enrichments": [
28
110
  {
29
- "outputKey": "pkey",
30
- "staticString": "$$PARTNER_KEY$$"
111
+ "outputKey": "tag",
112
+ "staticString": "pr_$$TAGGING_HASH$$_listing_"
31
113
  }
32
- ],
114
+ ]
115
+ },
116
+ "product_list_viewed": {
33
117
  "mappings": [
34
118
  {
35
- "inputKey": "anonymousId",
36
- "outputKey": "aid"
37
- },
119
+ "inputKey": "input",
120
+ "outputKey": "tag",
121
+ "transforms": [
122
+ {
123
+ "expression": {
124
+ "body": "return JOIN({\n 'pr_$$TAGGING_HASH$$',\n 'category2',\n input.properties.category or input.properties.list_id or ''\n}, '_')",
125
+ "lang": "lua"
126
+ }
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ },
132
+ "product_viewed": {
133
+ "mappings": [
134
+ {
135
+ "inputKey": "input",
136
+ "outputKey": "tag",
137
+ "transforms": [
138
+ {
139
+ "expression": {
140
+ "body": "return JOIN({\n 'pr_$$TAGGING_HASH$$',\n 'offer',\n input.properties.product_id or input.properties.sku or ''\n}, '_')",
141
+ "lang": "lua"
142
+ }
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ },
148
+ "product_added": {
149
+ "mappings": [
38
150
  {
39
151
  "inputKey": "input",
40
- "outputKey": "time",
152
+ "outputKey": "tag",
41
153
  "transforms": [
42
154
  {
43
155
  "expression": {
44
- "body": "return MILLISECONDS_SINCE_EPOCH_FROM_RFC3999(input.timestamp or input.originalTimestamp or input.sentAt)",
156
+ "body": "return JOIN({\n 'pr_$$TAGGING_HASH$$',\n 'basketadd',\n input.properties.product_id or input.properties.sku or ''\n}, '_')",
45
157
  "lang": "lua"
46
158
  }
47
159
  }
48
160
  ]
49
- },
161
+ }
162
+ ]
163
+ },
164
+ "product_added_to_wishlist": {
165
+ "mappings": [
166
+ {
167
+ "inputKey": "input",
168
+ "outputKey": "tag",
169
+ "transforms": [
170
+ {
171
+ "expression": {
172
+ "body": "return JOIN({\n 'pr_$$TAGGING_HASH$$',\n 'wishlist',\n input.properties.product_id or input.properties.sku or ''\n}, '_')",
173
+ "lang": "lua"
174
+ }
175
+ }
176
+ ]
177
+ }
178
+ ]
179
+ },
180
+ "cart_viewed": {
181
+ "mappings": [
182
+ {
183
+ "inputKey": "input",
184
+ "outputKey": "tag",
185
+ "transforms": [
186
+ {
187
+ "expression": {
188
+ "body": "local value = SUM(MAP(input.properties.products, function (p) return p.price * (p.quantity or 1) end));\nlocal products = MAP(input.properties.products, function (p) return p.product_id or p.sku or '' end );\nlocal orderID = input.properties.order_id or ''\nreturn JOIN({\n 'pr_$$TAGGING_HASH$$',\n 'basketstatus',\n JOIN(products, \",\")\n}, '_')",
189
+ "lang": "lua"
190
+ }
191
+ }
192
+ ]
193
+ }
194
+ ]
195
+ },
196
+ "checkout_started": {
197
+ "enrichments": [
198
+ {
199
+ "outputKey": "tag",
200
+ "staticString": "pr_$$TAGGING_HASH$$_startorder"
201
+ }
202
+ ]
203
+ },
204
+ "order_completed": {
205
+ "mappings": [
50
206
  {
51
207
  "inputKey": "input",
52
208
  "outputKey": "tag",
53
209
  "transforms": [
54
210
  {
55
211
  "expression": {
56
- "body": "local value = SUM(MAP(input.properties.products, function (p) return p.price * (p.quantity or 1) end));\nlocal products = MAP(input.properties.products, function (p) return p.product_id or p.sku end );\nreturn JOIN({\n 'pr_$$TAGGING_HASH$$',\n 'conversion_order_purchase',\n value,\n TRIM(TO_STRING(input.properties.order_id)),\n JOIN(products, \",\")\n}, '_')",
212
+ "body": "local value = SUM(MAP(input.properties.products, function (p) return p.price * (p.quantity or 1) end));\nlocal products = MAP(input.properties.products, function (p) return p.product_id or p.sku or '' end );\nlocal orderID = input.properties.order_id or ''\nreturn JOIN({\n 'pr_$$TAGGING_HASH$$',\n 'conversion_order_purchase',\n value,\n TRIM(TO_STRING(orderID)),\n JOIN(products, \",\")\n}, '_')",
57
213
  "lang": "lua"
58
214
  }
59
215
  }
package/README.md CHANGED
@@ -6,6 +6,8 @@ server, and other sources. It is particularly useful for tracking the pages or s
6
6
  users visit, the actions they take on your property, and whether the user has been identified
7
7
  previously.
8
8
  ## 2024-12
9
+ - Blueshift (BETA)
10
+ - Google Analytics 4 (Collect) (BETA)
9
11
  - Moloco (BETA)
10
12
  - RTB House (BETA)
11
13
 
@@ -29,7 +31,6 @@ previously.
29
31
  - AppsFlyer Android
30
32
  - AppsFlyer iOS
31
33
  - Microsoft Advertising (BETA)
32
- - Blueshift (BETA)
33
34
  - Clinch
34
35
  - Commission Junction
35
36
  - Criteo
@@ -37,7 +38,6 @@ previously.
37
38
  - Facebook Pixel
38
39
  - Google Ads - Conversions
39
40
  - Google Analytics
40
- - Google Analytics 4 (Collect) (BETA)
41
41
  - Firebase (BETA)
42
42
  - Heap (BETA)
43
43
  - HubSpot (BETA)
@@ -101,8 +101,10 @@ previously.
101
101
 
102
102
  | Kit Name | Date | Latest Note |
103
103
  |----------|------|-------------|
104
- | Moloco (BETA) | 2024-12 | Version: 0.2.0 Fixed time in milliseconds fidelity Added `id` field |
105
- | RTB House (BETA) | 2024-12 | Version: 0.1.1 Fixed event name from `order-completed` to `order_completed` Fixed time in milliseconds fidelity Improved order ID ensuring data type conversion to String |
104
+ | Blueshift (BETA) | 2024-12 | Version: 0.4.0 Changed birthday mapping for identify event. |
105
+ | Google Analytics 4 (Collect) (BETA) | 2024-12 | Version: 0.4.0 Added user property expression for anonymousId. |
106
+ | Moloco (BETA) | 2024-12 | Version: 0.3.0 Updated `page` events to Moloco's `HOME` or `PAGE_VIEW` event, based on `context.page.path` |
107
+ | RTB House (BETA) | 2024-12 | Version: 0.2.1 Updated Endpoint URL Added new fields for all events: page URL (`su`) and page referrer (`sr`) Added new events: identify, page, products_searched, product_list_viewed, product_viewed, product_added, product_added_to_wishlist, cart_viewed, checkout_started |
106
108
  | Adobe Analytics - Experience (BETA) | 2024-11 | Version: 0.6.0 Adding checkout event Updating inputKey for siteSection |
107
109
  | AWIN (BETA) | 2024-11 | Version: 0.1.0 Beta Version AWIN initial release |
108
110
  | Convert (BETA) | 2024-11 | Version: 0.3.0 Added new deduplication parameter for all events, `tid` |
@@ -120,7 +122,6 @@ previously.
120
122
  | AppsFlyer Android | 2024-10 | Version: 1.2.0 Added header `Accept-Encoding: application/json` |
121
123
  | AppsFlyer iOS | 2024-10 | Version: 1.2.0 Added header `Accept-Encoding: application/json` |
122
124
  | Microsoft Advertising (BETA) | 2024-10 | Version: 0.2.0 Added header `Accept-Encoding: application/json` |
123
- | Blueshift (BETA) | 2024-10 | Version: 0.3.0 Added header `Accept-Encoding: application/json` |
124
125
  | Clinch | 2024-10 | Version: 1.2.0 Added header `Accept-Encoding: application/json` |
125
126
  | Commission Junction | 2024-10 | Version: 1.2.0 Added header `Accept-Encoding: application/json` |
126
127
  | Criteo | 2024-10 | Version: 1.1.0 Added header `Accept-Encoding: application/json` |
@@ -128,7 +129,6 @@ previously.
128
129
  | Facebook Pixel | 2024-10 | Version: 1.3.0 Added header `Accept-Encoding: application/json` |
129
130
  | Google Ads - Conversions | 2024-10 | Version: 1.3.0 Added header `Accept-Encoding: application/json` |
130
131
  | Google Analytics | 2024-10 | Deprecating kit |
131
- | Google Analytics 4 (Collect) (BETA) | 2024-10 | Version: 0.3.0 Added header `Accept-Encoding: application/json` |
132
132
  | Firebase (BETA) | 2024-10 | Version: 0.2.0 Updated header `Accept-Encoding: application/json` |
133
133
  | Heap (BETA) | 2024-10 | Version: 0.2.0 Updated header `Accept-Encoding: application/json` |
134
134
  | HubSpot (BETA) | 2024-10 | Version: 0.3.0 Added header `Accept-Encoding: application/json` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metarouter/ajs-starter-kit",
3
- "version": "1.0.114",
3
+ "version": "1.0.116",
4
4
  "description": "MetaRouter analytics.js starter kit",
5
5
  "main": "index.js",
6
6
  "scripts": {