@metarouter/ajs-starter-kit 1.0.66 → 1.0.67

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
+ "6d0279d8db032deebc6bd9c4407dc5f6"
@@ -0,0 +1,38 @@
1
+ {
2
+ "params": [
3
+ {
4
+ "name": "TENANT",
5
+ "exampleValue": "my-tenant-id"
6
+ },
7
+ {
8
+ "name": "TOKEN",
9
+ "exampleValue": "my-token"
10
+ },
11
+ {
12
+ "name": "STREAM_ID",
13
+ "exampleValue": "my-stream-id"
14
+ }
15
+ ],
16
+ "default": {
17
+ "endpoint": "https://$$TENANT$$.amperity.com/stream/v0/data/$$STREAM_ID$$",
18
+ "method": "POST",
19
+ "headers": [
20
+ {
21
+ "key": "X-Amperity-Tenant",
22
+ "value": "$$TENANT$$"
23
+ },
24
+ {
25
+ "key": "Content-Type",
26
+ "value": "application/json"
27
+ },
28
+ {
29
+ "key": "Accept-Encoding",
30
+ "value": "application/json"
31
+ },
32
+ {
33
+ "key": "Authorization",
34
+ "value": "Bearer $$TOKEN$$"
35
+ }
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1 @@
1
+ "9da41f567b9b941480afd455d121428c"
@@ -0,0 +1,20 @@
1
+ {
2
+ "isDraft": false,
3
+ "isBeta": true,
4
+ "friendlyName": "Amperity",
5
+ "description": "Amperity is a customer data platform that helps companies to unify their customer data from multiple sources",
6
+ "logo": "https://cdn.metarouter.io/Amperity.png",
7
+ "color": "#10BC8B",
8
+ "eventSource": {
9
+ "isAndroidApp": false,
10
+ "isIosApp": false,
11
+ "isWebApp": true
12
+ },
13
+ "inputSchema": "analytics_js",
14
+ "releaseNotes": [
15
+ {
16
+ "date": "2023-07-06T00:00:00.000Z",
17
+ "note": "Amperity initial release."
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1 @@
1
+ "71c76dbec22bb55c09a564e607db8635"
@@ -0,0 +1,51 @@
1
+ {
2
+ "version": "v0.0.1",
3
+ "global": {
4
+ "mappings": [
5
+ {
6
+ "inputKey": "messageId",
7
+ "outputKey": "messageId"
8
+ },
9
+ {
10
+ "inputKey": "anonymousId",
11
+ "outputKey": "anonymousId"
12
+ },
13
+ {
14
+ "inputKey": "userId",
15
+ "outputKey": "userId"
16
+ },
17
+ {
18
+ "inputKey": "originalTimestamp",
19
+ "outputKey": "originalTimestamp"
20
+ },
21
+ {
22
+ "inputKey": "timestamp",
23
+ "outputKey": "timestamp"
24
+ },
25
+ {
26
+ "inputKey": "context.userAgent",
27
+ "outputKey": "context.userAgent"
28
+ },
29
+ {
30
+ "inputKey": "context.providers",
31
+ "outputKey": "context.providers"
32
+ },
33
+ {
34
+ "inputKey": "traits",
35
+ "outputKey": "traits"
36
+ },
37
+ {
38
+ "inputKey": "type",
39
+ "outputKey": "event",
40
+ "transforms": [
41
+ {
42
+ "expression": {
43
+ "lang": "lua",
44
+ "body": "if (input.type == \"track\") then return REPLACE(LOWER(input.event), \" \", \"_\") end\nreturn input.type"
45
+ }
46
+ }
47
+ ]
48
+ }
49
+ ]
50
+ }
51
+ }
@@ -1 +1 @@
1
- "3cceb92d73d335e9c013d6743bfd5cb9"
1
+ "73c6b6f474f87a38856041e850bebb14"
@@ -1,5 +1,5 @@
1
1
  {
2
- "isDraft": false,
2
+ "isDraft": true,
3
3
  "isBeta": true,
4
4
  "friendlyName": "Google Ads",
5
5
  "description": "Google Ads makes it easy to show the world what’s unique about your business, so you can reach customers searching for what you offer.",
@@ -19,6 +19,10 @@
19
19
  {
20
20
  "date": "2022-11-16T00:00:00.000Z",
21
21
  "note": "Add isBeta field"
22
+ },
23
+ {
24
+ "date": "2023-07-04T00:00:00.000Z",
25
+ "note": "Deprecating this in favor of the newly released Google Ads kit"
22
26
  }
23
27
  ]
24
28
  }
@@ -0,0 +1 @@
1
+ "754d227567ff86705430a30e69bbbdf9"
@@ -0,0 +1,72 @@
1
+ {
2
+ "params": [
3
+ {
4
+ "name": "API_VERSION",
5
+ "defaultValue": "v14"
6
+ },
7
+ {
8
+ "name": "CUSTOMER_ID",
9
+ "exampleValue": "customer-id"
10
+ },
11
+ {
12
+ "name": "SERVICE_ACCOUNT_CLIENT_EMAIL",
13
+ "exampleValue": "service-account-client-email"
14
+ },
15
+ {
16
+ "name": "SERVICE_ACCOUNT_PRIVATE_KEY",
17
+ "exampleValue": "service-account-private-key"
18
+ }
19
+ ],
20
+ "default": {
21
+ "endpoint": "https://googleads.googleapis.com/$$API_VERSION$$/customers/$$CUSTOMER_ID$$:uploadClickConversions",
22
+ "batchSize": 100,
23
+ "method": "POST",
24
+ "headers": [
25
+ {
26
+ "key": "Content-Type",
27
+ "value": "application/x-www-form-urlencoded"
28
+ },
29
+ {
30
+ "key": "Accept-Encoding",
31
+ "value": "application/json"
32
+ }
33
+ ],
34
+ "oauth2_auth": {
35
+ "request": {
36
+ "url": "https://oauth2.googleapis.com/token",
37
+ "contentType": "application/x-www-form-urlencoded",
38
+ "method": "POST",
39
+ "body": [
40
+ {
41
+ "key": "grant_type",
42
+ "value": "urn:ietf:params:oauth:grant-type:jwt-bearer"
43
+ }
44
+ ]
45
+ },
46
+ "responseAccessTokenKey": "access_token",
47
+ "jwt": {
48
+ "claims": [
49
+ {
50
+ "key": "aud",
51
+ "value": "https://oauth2.googleapis.com/token"
52
+ },
53
+ {
54
+ "key": "scope",
55
+ "value": "https://www.googleapis.com/auth/adwords"
56
+ },
57
+ {
58
+ "key": "iss",
59
+ "value": "$$SERVICE_ACCOUNT_CLIENT_EMAIL$$"
60
+ }
61
+ ],
62
+ "signingMethod": "SIGNING_METHOD_RS256",
63
+ "rsaPemKey": "$$SERVICE_ACCOUNT_PRIVATE_KEY$$",
64
+ "requestKey": "assertion"
65
+ }
66
+ },
67
+ "transform": {
68
+ "lang": "lua",
69
+ "body": "request.body = { conversions = batch }\nreturn request"
70
+ }
71
+ }
72
+ }
@@ -0,0 +1 @@
1
+ "c0f1ae5b49b9dfcd4543bb181ead9c4f"
@@ -0,0 +1,20 @@
1
+ {
2
+ "isDraft": false,
3
+ "isBeta": true,
4
+ "friendlyName": "Google Ads",
5
+ "description": "Google Ads is an online advertising platform developed by Google, where advertisers bid to display advertisements to users.",
6
+ "logo": "https://cdn.metarouter.io/logo.svg",
7
+ "color": "#4185f5",
8
+ "eventSource": {
9
+ "isAndroidApp": true,
10
+ "isIosApp": true,
11
+ "isWebApp": true
12
+ },
13
+ "inputSchema": "analytics_js",
14
+ "releaseNotes": [
15
+ {
16
+ "date": "2023-07-04T00:00:00.000Z",
17
+ "note": "Google Ads initial release."
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1 @@
1
+ "784aa57838afc393f56535fc586b8dae"
@@ -0,0 +1,148 @@
1
+ {
2
+ "version": "v0.0.1",
3
+ "params": [
4
+ {
5
+ "name": "CUSTOMER_ID",
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
+ }
16
+ ],
17
+ "default": {
18
+ "filters": [
19
+ {
20
+ "byEventNames": {
21
+ "action": "allow",
22
+ "events": [
23
+ ""
24
+ ]
25
+ }
26
+ }
27
+ ]
28
+ },
29
+ "global": {
30
+ "expressions": [
31
+ {
32
+ "lang": "lua",
33
+ "body": "local click_ids = {}\nif input.context.providers.googleGtag.data.wbraid then\n click_ids.wbraid = input.context.providers.googleGtag.data.wbraid\nelseif input.context.providers.googleGtag.data.gbraid then\n click_ids.gbraid = input.context.providers.googleGtag.data.gbraid\nend\nreturn click_ids"
34
+ }
35
+ ],
36
+ "filters": [
37
+ {
38
+ "byConditions": {
39
+ "action": "allow",
40
+ "when": {
41
+ "inputPathExists": {
42
+ "inputPath": "context.providers.googleGtag.data.gclid"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ ],
48
+ "mappings": [
49
+ {
50
+ "inputKey": "context.providers.googleGtag.data.gclid",
51
+ "outputKey": "gclid"
52
+ },
53
+ {
54
+ "inputKey": "input",
55
+ "outputKey": "userIdentifiers",
56
+ "transforms": [
57
+ {
58
+ "expression": {
59
+ "lang": "lua",
60
+ "body": "if input.traits.email then\n return {{ hashedEmail = TO_SHA256_HASH(LOWER(TRIM(input.traits.email))) }}\nend"
61
+ }
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ "inputKey": "input",
67
+ "outputKey": "conversionDateTime",
68
+ "transforms": [
69
+ {
70
+ "expression": {
71
+ "lang": "lua",
72
+ "body": "local date = input.originalTimestamp or input.sentAt\nlocal timezoneOffset = input.context.providers.googleGtag.data.timezone_offset or 0\nreturn TO_DATE_TIME(date, { inputFormat = \"2006-01-02T15:04:05Z07:00\", outputLocation = { name = \"!UTC\", offset = TO_TRUNCATED_INT(timezoneOffset) * 60 }, outputFormat = \"2006-01-02 15:04:05-07:00\" })"
73
+ }
74
+ }
75
+ ]
76
+ }
77
+ ]
78
+ },
79
+ "eventSpecific": {
80
+ "page": {
81
+ "enrichments": [
82
+ {
83
+ "outputKey": "conversionValue",
84
+ "staticInt": 1
85
+ }
86
+ ],
87
+ "mappings": [
88
+ {
89
+ "inputKey": "input",
90
+ "outputKey": "conversionAction",
91
+ "transforms": [
92
+ {
93
+ "expression": {
94
+ "body": "return \"customers/$$CUSTOMER_ID$$/conversionActions/$$PAGE_CONVERSION_ACTION$$\"",
95
+ "lang": "lua"
96
+ }
97
+ }
98
+ ]
99
+ }
100
+ ]
101
+ },
102
+ "order_completed": {
103
+ "mappings": [
104
+ {
105
+ "inputKey": "input",
106
+ "outputKey": "conversionAction",
107
+ "transforms": [
108
+ {
109
+ "expression": {
110
+ "body": "return \"customers/$$CUSTOMER_ID$$/conversionActions/$$ORDER_COMPLETED_CONVERSION_ACTION$$\"",
111
+ "lang": "lua"
112
+ }
113
+ }
114
+ ]
115
+ },
116
+ {
117
+ "inputKey": "properties.currency",
118
+ "outputKey": "currencyCode",
119
+ "transforms": [
120
+ {
121
+ "modifyString": "uppercase"
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "inputKey": "properties.revenue",
127
+ "outputKey": "conversionValue"
128
+ },
129
+ {
130
+ "inputKey": "properties.order_id",
131
+ "outputKey": "orderId"
132
+ },
133
+ {
134
+ "inputKey": "input",
135
+ "outputKey": "cartData.items",
136
+ "transforms": [
137
+ {
138
+ "expression": {
139
+ "body": "return MAP(\n input.properties.products,\n function (p)\n return {\n productId = p.product_id,\n quantity = p.quantity or 1,\n unitPrice = p.price\n }\n end\n)",
140
+ "lang": "lua"
141
+ }
142
+ }
143
+ ]
144
+ }
145
+ ]
146
+ }
147
+ }
148
+ }
@@ -1 +1 @@
1
- "861bbf3e2f69d82bc666d311ea580f62"
1
+ "367871f405d0a7248e21e5d2082adc89"
@@ -11,7 +11,11 @@
11
11
  "key": "Accept-Encoding",
12
12
  "value": "application/json"
13
13
  }
14
- ]
14
+ ],
15
+ "transform": {
16
+ "lang": "lua",
17
+ "body": "request.body = {\n client_id = batch[1].client_id,\n user_id = batch[1].user_id,\n timestamp_micros = batch[1].timestamp_micros,\n events = { batch[1].event }\n}\nreturn request"
18
+ }
15
19
  },
16
20
  "params": [
17
21
  {
@@ -1 +1 @@
1
- "6f425f03ed0c7cece997050145befbe7"
1
+ "dca5841b9eb56f231eeecb81da0da760"
@@ -1 +1 @@
1
- "cd606abbb639430e994aa75840b008fd"
1
+ "4f8f201e28e6eef7e88e9ead092d1e8e"
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "version": "v0.0.1",
3
3
  "global": {
4
+ "enrichments": [
5
+ {
6
+ "outputKey": "event.params.data_source",
7
+ "staticString": "S2S"
8
+ }
9
+ ],
4
10
  "mappings": [
5
11
  {
6
12
  "inputKey": "userId",
@@ -29,35 +35,65 @@
29
35
  }
30
36
  }
31
37
  ]
38
+ },
39
+ {
40
+ "inputKey": "input",
41
+ "outputKey": "event.params.gclid",
42
+ "transforms": [
43
+ {
44
+ "expression": {
45
+ "body": "return DECODE_URL_QUERY(input.context.page.url).gclid",
46
+ "lang": "lua"
47
+ }
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ "inputKey": "input",
53
+ "outputKey": "event.params.dclid",
54
+ "transforms": [
55
+ {
56
+ "expression": {
57
+ "body": "return DECODE_URL_QUERY(input.context.page.url).dclid",
58
+ "lang": "lua"
59
+ }
60
+ }
61
+ ]
32
62
  }
33
63
  ]
34
64
  },
35
65
  "eventSpecific": {
36
66
  "page": {
67
+ "enrichments": [
68
+ {
69
+ "outputKey": "event.name",
70
+ "staticString": "page_view"
71
+ }
72
+ ],
37
73
  "mappings": [
74
+ {
75
+ "inputKey": "properties.title",
76
+ "outputKey": "event.params.page_title"
77
+ },
38
78
  {
39
79
  "inputKey": "input",
40
- "outputKey": "events",
80
+ "outputKey": "event.params.page_location",
41
81
  "transforms": [
42
82
  {
43
83
  "expression": {
44
- "body": "local event_details = {}\nevent_details.name = 'page_view'\nlocal params = {}\nparams.page_title = input.properties.title\nparams.page_location = SPLIT(input.properties.url, \"?\", 1)[1] or \"\"\nparams.page_referrer = SPLIT(input.properties.referrer, \"?\", 1)[1] or \"\"\nparams.page_type = input.properties.pageType\nparams.page_sub_category = input.properties.subCategory2\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
84
+ "body": "return SPLIT(input.properties.url, \"?\", 1)[1] or \"\"",
45
85
  "lang": "lua"
46
86
  }
47
87
  }
48
88
  ]
49
- }
50
- ]
51
- },
52
- "products_searched": {
53
- "mappings": [
89
+ },
54
90
  {
55
91
  "inputKey": "input",
56
- "outputKey": "events",
92
+ "outputKey": "event.params.page_referrer",
57
93
  "transforms": [
58
94
  {
59
95
  "expression": {
60
- "body": "local event_details = {}\nevent_details.name = 'search'\nlocal params = {}\nparams.search_term = input.properties.query\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
96
+ "body": "return SPLIT(input.properties.referrer, \"?\", 1)[1] or \"\"",
61
97
  "lang": "lua"
62
98
  }
63
99
  }
@@ -65,15 +101,43 @@
65
101
  }
66
102
  ]
67
103
  },
104
+ "products_searched": {
105
+ "enrichments": [
106
+ {
107
+ "outputKey": "event.name",
108
+ "staticString": "search"
109
+ }
110
+ ],
111
+ "mappings": [
112
+ {
113
+ "inputKey": "properties.query",
114
+ "outputKey": "event.params.search_term"
115
+ }
116
+ ]
117
+ },
68
118
  "product_list_viewed": {
119
+ "enrichments": [
120
+ {
121
+ "outputKey": "event.name",
122
+ "staticString": "view_item_list"
123
+ }
124
+ ],
69
125
  "mappings": [
126
+ {
127
+ "inputKey": "properties.list_id",
128
+ "outputKey": "event.params.item_list_id"
129
+ },
130
+ {
131
+ "inputKey": "properties.category",
132
+ "outputKey": "event.params.item_list_name"
133
+ },
70
134
  {
71
135
  "inputKey": "input",
72
- "outputKey": "events",
136
+ "outputKey": "event.params.items",
73
137
  "transforms": [
74
138
  {
75
139
  "expression": {
76
- "body": "local event_details = {}\nevent_details.name = 'view_item_list'\nlocal params = {}\nparams.item_list_id = input.properties.list_id\nparams.item_list_name = input.properties.category\nparams.items = input.properties.products\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
140
+ "body": "local items = {}\nfor index, product in pairs(input.properties.products) do\n local item = {}\n item.coupon = product.coupon\n item.item_brand = product.brand\n item.item_category = product.category\n item.item_id = product.product_id\n item.item_name = product.name\n item.item_price = product.price\n item.item_quantity = product.quantity\n items[index] = item\nend\nreturn items",
77
141
  "lang": "lua"
78
142
  }
79
143
  }
@@ -82,46 +146,76 @@
82
146
  ]
83
147
  },
84
148
  "promotion_viewed": {
149
+ "enrichments": [
150
+ {
151
+ "outputKey": "event.name",
152
+ "staticString": "view_promotion"
153
+ }
154
+ ],
85
155
  "mappings": [
86
156
  {
87
- "inputKey": "input",
88
- "outputKey": "events",
89
- "transforms": [
90
- {
91
- "expression": {
92
- "body": "local event_details = {}\nevent_details.name = 'view_promotion'\nlocal params = {}\nparams.promotion_id = input.properties.promotion_id\nparams.creative_name = input.properties.creative\nparams.promotion_name = input.properties.name\nparams.creative_slot = input.properties.position\nparams.items = input.properties.items\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
93
- "lang": "lua"
94
- }
95
- }
96
- ]
157
+ "inputKey": "properties.promotion_id",
158
+ "outputKey": "event.params.promotion_id"
159
+ },
160
+ {
161
+ "inputKey": "properties.name",
162
+ "outputKey": "event.params.promotion_name"
163
+ },
164
+ {
165
+ "inputKey": "properties.creative",
166
+ "outputKey": "event.params.creative_name"
167
+ },
168
+ {
169
+ "inputKey": "properties.position",
170
+ "outputKey": "event.params.creative_slot"
97
171
  }
98
172
  ]
99
173
  },
100
174
  "promotion_clicked": {
175
+ "enrichments": [
176
+ {
177
+ "outputKey": "event.name",
178
+ "staticString": "select_promotion"
179
+ }
180
+ ],
101
181
  "mappings": [
102
182
  {
103
- "inputKey": "input",
104
- "outputKey": "events",
105
- "transforms": [
106
- {
107
- "expression": {
108
- "body": "local event_details = {}\nevent_details.name = 'select_promotion'\nlocal params = {}\nparams.promotion_id = input.properties.promotion_id\nparams.creative_name = input.properties.creative\nparams.promotion_name = input.properties.name\nparams.creative_slot = input.properties.position\nparams.items = input.properties.items\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
109
- "lang": "lua"
110
- }
111
- }
112
- ]
183
+ "inputKey": "properties.promotion_id",
184
+ "outputKey": "event.params.promotion_id"
185
+ },
186
+ {
187
+ "inputKey": "properties.name",
188
+ "outputKey": "event.params.promotion_name"
189
+ },
190
+ {
191
+ "inputKey": "properties.creative",
192
+ "outputKey": "event.params.creative_name"
193
+ },
194
+ {
195
+ "inputKey": "properties.position",
196
+ "outputKey": "event.params.creative_slot"
113
197
  }
114
198
  ]
115
199
  },
116
200
  "product_clicked": {
201
+ "enrichments": [
202
+ {
203
+ "outputKey": "event.name",
204
+ "staticString": "select_item"
205
+ }
206
+ ],
117
207
  "mappings": [
208
+ {
209
+ "inputKey": "properties.currency",
210
+ "outputKey": "event.params.currency"
211
+ },
118
212
  {
119
213
  "inputKey": "input",
120
- "outputKey": "events",
214
+ "outputKey": "event.params.items",
121
215
  "transforms": [
122
216
  {
123
217
  "expression": {
124
- "body": "local event_details = {}\nevent_details.name = 'select_item'\nlocal params = {}\nparams.items = {}\nlocal item = {}\nitem.item_id = input.properties.product_id\nitem.item_name = input.properties.name\nitem.coupon = input.properties.coupon\nitem.currency = input.properties.currency\nitem.item_brand = input.properties.brand\nitem.item_category = input.properties.category\nitem.item_price = input.properties.price\nitem.item_quantity = input.properties.quantity\nparams.items[1] = item\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
218
+ "body": "return {{\n coupon = input.properties.coupon,\n item_brand = input.properties.brand,\n item_category = input.properties.category,\n item_id = input.properties.product_id,\n item_name = input.properties.name,\n item_price = input.properties.price,\n item_quantity = input.properties.quantity\n}}",
125
219
  "lang": "lua"
126
220
  }
127
221
  }
@@ -130,14 +224,28 @@
130
224
  ]
131
225
  },
132
226
  "product_viewed": {
227
+ "enrichments": [
228
+ {
229
+ "outputKey": "event.name",
230
+ "staticString": "view_item"
231
+ }
232
+ ],
133
233
  "mappings": [
234
+ {
235
+ "inputKey": "properties.currency",
236
+ "outputKey": "event.params.currency"
237
+ },
238
+ {
239
+ "inputKey": "properties.value",
240
+ "outputKey": "event.params.value"
241
+ },
134
242
  {
135
243
  "inputKey": "input",
136
- "outputKey": "events",
244
+ "outputKey": "event.params.items",
137
245
  "transforms": [
138
246
  {
139
247
  "expression": {
140
- "body": "local event_details = {}\nevent_details.name = 'view_item'\nlocal params = {}\nparams.items = {}\nlocal item = {}\nitem.item_id = input.properties.product_id\nitem.item_name = input.properties.name\nitem.coupon = input.properties.coupon\nitem.currency = input.properties.currency\nitem.item_brand = input.properties.brand\nitem.item_category = input.properties.category\nitem.item_price = input.properties.price\nitem.item_quantity = input.properties.quantity\nparams.items[1] = item\nparams.currency = input.properties.currency\nparams.value = input.properties.value\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
248
+ "body": "return {{\n coupon = input.properties.coupon,\n item_brand = input.properties.brand,\n item_category = input.properties.category,\n item_id = input.properties.product_id,\n item_name = input.properties.name,\n item_price = input.properties.price,\n item_quantity = input.properties.quantity\n}}",
141
249
  "lang": "lua"
142
250
  }
143
251
  }
@@ -146,14 +254,28 @@
146
254
  ]
147
255
  },
148
256
  "product_added": {
257
+ "enrichments": [
258
+ {
259
+ "outputKey": "event.name",
260
+ "staticString": "add_to_cart"
261
+ }
262
+ ],
149
263
  "mappings": [
264
+ {
265
+ "inputKey": "properties.currency",
266
+ "outputKey": "event.params.currency"
267
+ },
268
+ {
269
+ "inputKey": "properties.value",
270
+ "outputKey": "event.params.value"
271
+ },
150
272
  {
151
273
  "inputKey": "input",
152
- "outputKey": "events",
274
+ "outputKey": "event.params.items",
153
275
  "transforms": [
154
276
  {
155
277
  "expression": {
156
- "body": "local event_details = {}\nevent_details.name = 'add_to_cart'\nlocal params = {}\nparams.items = {}\nlocal item = {}\nitem.item_id = input.properties.product_id\nitem.item_name = input.properties.name\nitem.coupon = input.properties.coupon\nitem.currency = input.properties.currency\nitem.item_brand = input.properties.brand\nitem.item_category = input.properties.category\nitem.item_price = input.properties.price\nitem.item_quantity = input.properties.quantity\nparams.items[1] = item\nparams.currency = input.properties.currency\nparams.value = input.properties.value\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
278
+ "body": "return {{\n coupon = input.properties.coupon,\n item_brand = input.properties.brand,\n item_category = input.properties.category,\n item_id = input.properties.product_id,\n item_name = input.properties.name,\n item_price = input.properties.price,\n item_quantity = input.properties.quantity\n}}",
157
279
  "lang": "lua"
158
280
  }
159
281
  }
@@ -162,14 +284,28 @@
162
284
  ]
163
285
  },
164
286
  "product_removed": {
287
+ "enrichments": [
288
+ {
289
+ "outputKey": "event.name",
290
+ "staticString": "remove_from_cart"
291
+ }
292
+ ],
165
293
  "mappings": [
294
+ {
295
+ "inputKey": "properties.currency",
296
+ "outputKey": "event.params.currency"
297
+ },
298
+ {
299
+ "inputKey": "properties.value",
300
+ "outputKey": "event.params.value"
301
+ },
166
302
  {
167
303
  "inputKey": "input",
168
- "outputKey": "events",
304
+ "outputKey": "event.params.items",
169
305
  "transforms": [
170
306
  {
171
307
  "expression": {
172
- "body": "local event_details = {}\nevent_details.name = 'remove_from_cart'\nlocal params = {}\nparams.items = {}\nlocal item = {}\nitem.item_id = input.properties.product_id\nitem.item_name = input.properties.name\nitem.coupon = input.properties.coupon\nitem.currency = input.properties.currency\nitem.item_brand = input.properties.brand\nitem.item_category = input.properties.category\nitem.item_price = input.properties.price\nitem.item_quantity = input.properties.quantity\nparams.items[1] = item\nparams.currency = input.properties.currency\nparams.value = input.properties.value\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
308
+ "body": "return {{\n coupon = input.properties.coupon,\n item_brand = input.properties.brand,\n item_category = input.properties.category,\n item_id = input.properties.product_id,\n item_name = input.properties.name,\n item_price = input.properties.price,\n item_quantity = input.properties.quantity\n}}",
173
309
  "lang": "lua"
174
310
  }
175
311
  }
@@ -178,14 +314,36 @@
178
314
  ]
179
315
  },
180
316
  "cart_viewed": {
317
+ "enrichments": [
318
+ {
319
+ "outputKey": "event.name",
320
+ "staticString": "view_cart"
321
+ }
322
+ ],
181
323
  "mappings": [
324
+ {
325
+ "inputKey": "properties.currency",
326
+ "outputKey": "event.params.currency"
327
+ },
182
328
  {
183
329
  "inputKey": "input",
184
- "outputKey": "events",
330
+ "outputKey": "event.params.value",
185
331
  "transforms": [
186
332
  {
187
333
  "expression": {
188
- "body": "local event_details = {}\nevent_details.name = 'view_cart'\nlocal params = {}\nparams.currency = input.properties.currency\nparams.value = 0\nparams.items = {}\nfor inputIndex, product in pairs(input.properties.products) do\n local item = {}\n item.item_id = product.product_id\n item.item_name = product.name\n item.coupon = product.coupon\n item.item_brand = product.brand\n item.item_category = product.category\n item.item_price = product.price\n item.item_quantity = product.quantity\n params.items[inputIndex] = item\n params.value = params.value + (product.price * product.quantity)\nend\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
334
+ "body": "return SUM(MAP(input.properties.products, function (product) return product.price * (product.quantity or 1) end))",
335
+ "lang": "lua"
336
+ }
337
+ }
338
+ ]
339
+ },
340
+ {
341
+ "inputKey": "input",
342
+ "outputKey": "event.params.items",
343
+ "transforms": [
344
+ {
345
+ "expression": {
346
+ "body": "local items = {}\nfor index, product in pairs(input.properties.products) do\n local item = {}\n item.coupon = product.coupon\n item.item_brand = product.brand\n item.item_category = product.category\n item.item_id = product.product_id\n item.item_name = product.name\n item.item_price = product.price\n item.item_quantity = product.quantity\n items[index] = item\nend\nreturn items",
189
347
  "lang": "lua"
190
348
  }
191
349
  }
@@ -194,14 +352,44 @@
194
352
  ]
195
353
  },
196
354
  "order_completed": {
355
+ "enrichments": [
356
+ {
357
+ "outputKey": "event.name",
358
+ "staticString": "purchase"
359
+ }
360
+ ],
197
361
  "mappings": [
362
+ {
363
+ "inputKey": "properties.coupon",
364
+ "outputKey": "event.params.coupon"
365
+ },
366
+ {
367
+ "inputKey": "properties.currency",
368
+ "outputKey": "event.params.currency"
369
+ },
370
+ {
371
+ "inputKey": "properties.shipping",
372
+ "outputKey": "event.params.shipping"
373
+ },
374
+ {
375
+ "inputKey": "properties.tax",
376
+ "outputKey": "event.params.tax"
377
+ },
378
+ {
379
+ "inputKey": "properties.checkout_id",
380
+ "outputKey": "event.params.transaction_id"
381
+ },
382
+ {
383
+ "inputKey": "properties.total",
384
+ "outputKey": "event.params.value"
385
+ },
198
386
  {
199
387
  "inputKey": "input",
200
- "outputKey": "events",
388
+ "outputKey": "event.params.items",
201
389
  "transforms": [
202
390
  {
203
391
  "expression": {
204
- "body": "local event_details = {}\nevent_details.name = 'purchase'\nlocal params = {}\nparams.currency = input.properties.currency\nparams.transaction_id = input.properties.checkout_id\nparams.value = input.properties.total\nparams.coupon = input.properties.coupon\nparams.shipping = input.properties.shipping\nparams.tax = input.properties.tax\nparams.items = {}\nfor inputIndex, product in pairs(input.properties.products) do\n local item = {}\n item.item_id = product.product_id\n item.item_name = product.name\n item.coupon = product.coupon\n item.item_brand = product.brand\n item.item_category = product.category\n item.item_price = product.price\n item.item_quantity = product.quantity\n params.items[inputIndex] = item\nend\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
392
+ "body": "local items = {}\nfor index, product in pairs(input.properties.products) do\n local item = {}\n item.coupon = product.coupon\n item.item_brand = product.brand\n item.item_category = product.category\n item.item_id = product.product_id\n item.item_name = product.name\n item.item_price = product.price\n item.item_quantity = product.quantity\n items[index] = item\nend\nreturn items",
205
393
  "lang": "lua"
206
394
  }
207
395
  }
@@ -214,11 +402,11 @@
214
402
  "mappings": [
215
403
  {
216
404
  "inputKey": "input",
217
- "outputKey": "events",
405
+ "outputKey": "event",
218
406
  "transforms": [
219
407
  {
220
408
  "expression": {
221
- "body": "local event_details = {}\nevent_details.name = input.event\nlocal params = input.properties\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn { event_details }",
409
+ "body": "local event_details = {}\nevent_details.name = REPLACE(LOWER(input.event), \" \", \"_\")\nlocal params = input.properties\nlocal gclid = DECODE_URL_QUERY(input.context.page.url).gclid\nif gclid then params.gclid = gclid end\nlocal dclid = DECODE_URL_QUERY(input.context.page.url).dclid\nif dclid then params.dclid = dclid end\nparams.data_source = 'S2S'\nevent_details.params = params\nreturn event_details",
222
410
  "lang": "lua"
223
411
  }
224
412
  }
@@ -1 +1 @@
1
- "7c6f01f2c5075a293f91d3103f2cf3ec"
1
+ "22e1334e9a85f7464cd8cd854cf03395"
@@ -30,7 +30,7 @@
30
30
  },
31
31
  {
32
32
  "date": "2023-07-10T00:00:00.000Z",
33
- "note": "Moving from Draft to Beta mode"
33
+ "note": "Migrate from _Draft_ to _Beta_"
34
34
  }
35
35
  ]
36
36
  }
@@ -1 +1 @@
1
- "107d7b4508c3a2f3853cb4ef602182f0"
1
+ "b04e2a153bb7942fdc8cbdc05a5bf150"
@@ -1 +1 @@
1
- "8690d6ffb1d011636ae0cbf816c291ac"
1
+ "333104bb41fd658bff6a76f39cd1f121"
@@ -1,5 +1,17 @@
1
1
  {
2
2
  "version": "v0.0.1",
3
+ "default": {
4
+ "filters": [
5
+ {
6
+ "byEventNames": {
7
+ "action": "allow",
8
+ "events": [
9
+ ""
10
+ ]
11
+ }
12
+ }
13
+ ]
14
+ },
3
15
  "global": {
4
16
  "enrichments": [
5
17
  {
@@ -153,6 +165,100 @@
153
165
  }
154
166
  ]
155
167
  },
168
+ "product_list_viewed": {
169
+ "enrichments": [
170
+ {
171
+ "outputKey": "event_name",
172
+ "staticString": "view_category"
173
+ }
174
+ ],
175
+ "mappings": [
176
+ {
177
+ "inputKey": "input",
178
+ "outputKey": "custom_data.content_ids",
179
+ "transforms": [
180
+ {
181
+ "expression": {
182
+ "body": "return MAP(input.properties.products, function (p) return p.product_id end )",
183
+ "lang": "lua"
184
+ }
185
+ }
186
+ ]
187
+ },
188
+ {
189
+ "inputKey": "input",
190
+ "outputKey": "custom_data.contents",
191
+ "transforms": [
192
+ {
193
+ "expression": {
194
+ "body": "local contents=MAP(input.properties.products,\n function (p)\n return {\n id=p.product_id,\n item_price=tostring(p.price),\n quantity=p.quantity\n }\n end\n)\nreturn contents",
195
+ "lang": "lua"
196
+ }
197
+ }
198
+ ]
199
+ }
200
+ ]
201
+ },
202
+ "product_viewed": {
203
+ "enrichments": [
204
+ {
205
+ "outputKey": "event_name",
206
+ "staticString": "page_visit"
207
+ }
208
+ ],
209
+ "mappings": [
210
+ {
211
+ "inputKey": "properties.currency",
212
+ "outputKey": "custom_data.currency",
213
+ "defaultString": "USD",
214
+ "transforms": [
215
+ {
216
+ "modifyString": "uppercase"
217
+ }
218
+ ]
219
+ },
220
+ {
221
+ "inputKey": "input",
222
+ "outputKey": "custom_data.value",
223
+ "transforms": [
224
+ {
225
+ "expression": {
226
+ "lang": "lua",
227
+ "body": "return tostring(input.properties.price * (input.properties.quantity or 1))"
228
+ }
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ "inputKey": "input",
234
+ "outputKey": "custom_data.content_ids",
235
+ "transforms": [
236
+ {
237
+ "expression": {
238
+ "body": "return { input.properties.product_id }",
239
+ "lang": "lua"
240
+ }
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ "inputKey": "input",
246
+ "outputKey": "custom_data.contents",
247
+ "transforms": [
248
+ {
249
+ "expression": {
250
+ "body": "return {{\n id=input.properties.product_id,\n item_price=tostring(input.properties.price),\n quantity=input.properties.quantity\n}}",
251
+ "lang": "lua"
252
+ }
253
+ }
254
+ ]
255
+ },
256
+ {
257
+ "inputKey": "properties.quantity",
258
+ "outputKey": "custom_data.num_items"
259
+ }
260
+ ]
261
+ },
156
262
  "product_added": {
157
263
  "enrichments": [
158
264
  {
@@ -201,7 +307,7 @@
201
307
  "transforms": [
202
308
  {
203
309
  "expression": {
204
- "body": "return {{\n item_price=tostring(input.properties.price),\n quantity=input.properties.quantity\n}}",
310
+ "body": "return {{\n id=input.properties.product_id,\n item_price=tostring(input.properties.price),\n quantity=input.properties.quantity\n}}",
205
311
  "lang": "lua"
206
312
  }
207
313
  }
@@ -213,6 +319,77 @@
213
319
  }
214
320
  ]
215
321
  },
322
+ "cart_viewed": {
323
+ "enrichments": [
324
+ {
325
+ "outputKey": "event_name",
326
+ "staticString": "page_visit"
327
+ }
328
+ ],
329
+ "mappings": [
330
+ {
331
+ "inputKey": "properties.currency",
332
+ "outputKey": "custom_data.currency",
333
+ "transforms": [
334
+ {
335
+ "modifyString": "uppercase"
336
+ }
337
+ ]
338
+ },
339
+ {
340
+ "inputKey": "input",
341
+ "outputKey": "custom_data.value",
342
+ "transforms": [
343
+ {
344
+ "expression": {
345
+ "lang": "lua",
346
+ "body": "return tostring(SUM(MAP(input.properties.products, function (p) return p.price * (p.quantity or 1) end)))"
347
+ }
348
+ }
349
+ ]
350
+ },
351
+ {
352
+ "inputKey": "input",
353
+ "outputKey": "custom_data.content_ids",
354
+ "transforms": [
355
+ {
356
+ "expression": {
357
+ "body": "return MAP(input.properties.products, function (p) return p.product_id end )",
358
+ "lang": "lua"
359
+ }
360
+ }
361
+ ]
362
+ },
363
+ {
364
+ "inputKey": "input",
365
+ "outputKey": "custom_data.contents",
366
+ "transforms": [
367
+ {
368
+ "expression": {
369
+ "body": "local contents=MAP(input.properties.products,\n function (p)\n return {\n id=p.product_id,\n item_price=tostring(p.price),\n quantity=p.quantity\n }\n end\n)\nreturn contents",
370
+ "lang": "lua"
371
+ }
372
+ }
373
+ ]
374
+ },
375
+ {
376
+ "inputKey": "input",
377
+ "outputKey": "custom_data.num_items",
378
+ "transforms": [
379
+ {
380
+ "expression": {
381
+ "lang": "lua",
382
+ "body": "return SUM(MAP(input.properties.products, function (p) return p.quantity or 1 end))"
383
+ }
384
+ }
385
+ ]
386
+ },
387
+ {
388
+ "inputKey": "properties.order_id",
389
+ "outputKey": "custom_data.order_id"
390
+ }
391
+ ]
392
+ },
216
393
  "order_completed": {
217
394
  "enrichments": [
218
395
  {
@@ -260,7 +437,7 @@
260
437
  "transforms": [
261
438
  {
262
439
  "expression": {
263
- "body": "local contents=MAP(input.properties.products,\n function (p)\n return {\n item_price=tostring(p.price),\n quantity=p.quantity\n }\n end\n)\nreturn contents",
440
+ "body": "local contents=MAP(input.properties.products,\n function (p)\n return {\n id=p.product_id,\n item_price=tostring(p.price),\n quantity=p.quantity\n }\n end\n)\nreturn contents",
264
441
  "lang": "lua"
265
442
  }
266
443
  }
package/index.js CHANGED
@@ -48,6 +48,13 @@ exports.amobee = {
48
48
  metadata: require('./.dist/amobee/metadata.json')
49
49
  }
50
50
 
51
+ exports.amperity = {
52
+ connectionTemplate: connectionSchemas.properties.amperity,
53
+ endpointSchema: require('./.dist/amperity/connection.json'),
54
+ playbook: require('./.dist/amperity/playbook.json'),
55
+ metadata: require('./.dist/amperity/metadata.json')
56
+ }
57
+
51
58
  exports.amplitude = {
52
59
  connectionTemplate: connectionSchemas.properties.amplitude,
53
60
  endpointSchema: require('./.dist/amplitude/connection.json'),
@@ -137,6 +144,13 @@ exports['google-ad-words'] = {
137
144
  metadata: require('./.dist/google-ad-words/metadata.json')
138
145
  }
139
146
 
147
+ exports['google-ads'] = {
148
+ connectionTemplate: connectionSchemas.properties.googleAds,
149
+ endpointSchema: require('./.dist/google-ads/connection.json'),
150
+ playbook: require('./.dist/google-ads/playbook.json'),
151
+ metadata: require('./.dist/google-ads/metadata.json')
152
+ }
153
+
140
154
  exports['google-analytics'] = {
141
155
  connectionTemplate: connectionSchemas.properties.googleAnalytics,
142
156
  endpointSchema: require('./.dist/google-analytics/connection.json'),
@@ -424,6 +438,11 @@ exports.etags = {
424
438
  playbook: require('./.dist/amobee/playbook.etag.json'),
425
439
  kit: require('./.dist/amobee/kit.etag.json')
426
440
  },
441
+ amperity: {
442
+ endpointSchema: require('./.dist/amperity/connection.etag.json'),
443
+ playbook: require('./.dist/amperity/playbook.etag.json'),
444
+ kit: require('./.dist/amperity/kit.etag.json')
445
+ },
427
446
  amplitude: {
428
447
  endpointSchema: require('./.dist/amplitude/connection.etag.json'),
429
448
  playbook: require('./.dist/amplitude/playbook.etag.json'),
@@ -488,6 +507,11 @@ exports.etags = {
488
507
  playbook: require('./.dist/google-ad-words/playbook.etag.json'),
489
508
  kit: require('./.dist/google-ad-words/kit.etag.json')
490
509
  },
510
+ 'google-ads': {
511
+ endpointSchema: require('./.dist/google-ads/connection.etag.json'),
512
+ playbook: require('./.dist/google-ads/playbook.etag.json'),
513
+ kit: require('./.dist/google-ads/kit.etag.json')
514
+ },
491
515
  'google-analytics': {
492
516
  endpointSchema: require('./.dist/google-analytics/connection.etag.json'),
493
517
  playbook: require('./.dist/google-analytics/playbook.etag.json'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metarouter/ajs-starter-kit",
3
- "version": "1.0.66",
3
+ "version": "1.0.67",
4
4
  "description": "MetaRouter analytics.js starter kit",
5
5
  "main": "index.js",
6
6
  "scripts": {