@metarouter/ajs-starter-kit 1.0.104 → 1.0.105

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
+ "8a2c80212609e82c64e64d02e5186ac3"
@@ -0,0 +1,58 @@
1
+ {
2
+ "params": [
3
+ {
4
+ "name": "PIXEL_ID",
5
+ "exampleValue": "my-pixel-id"
6
+ },
7
+ {
8
+ "name": "API_VERSION",
9
+ "exampleValue": "my-api-version",
10
+ "defaultValue": "12"
11
+ },
12
+ {
13
+ "name": "CONSUMER_KEY",
14
+ "exampleValue": "my-consumer-key"
15
+ },
16
+ {
17
+ "name": "CONSUMER_SECRET",
18
+ "exampleValue": "my-consumer-secret"
19
+ },
20
+ {
21
+ "name": "ACCESS_TOKEN",
22
+ "exampleValue": "my-access-token"
23
+ },
24
+ {
25
+ "name": "TOKEN_SECRET",
26
+ "exampleValue": "my-token-secret"
27
+ }
28
+ ],
29
+ "default": {
30
+ "endpoint": "https://ads-api.x.com/$$API_VERSION$$/measurement/conversions/$$PIXEL_ID$$",
31
+ "oauth1Auth": {
32
+ "consumer_key": "$$CONSUMER_KEY$$",
33
+ "consumer_secret": "$$CONSUMER_SECRET$$",
34
+ "access_token": "$$ACCESS_TOKEN$$",
35
+ "token_secret": "$$TOKEN_SECRET$$"
36
+ },
37
+ "batchSize": 250,
38
+ "transform": {
39
+ "lang": "lua",
40
+ "body": "request.body = { conversions = batch }\nreturn request"
41
+ },
42
+ "method": "POST",
43
+ "headers": [
44
+ {
45
+ "key": "Content-Type",
46
+ "value": "application/json"
47
+ },
48
+ {
49
+ "key": "Accept",
50
+ "value": "*/*"
51
+ },
52
+ {
53
+ "key": "Accept-Encoding",
54
+ "value": "application/json"
55
+ }
56
+ ]
57
+ }
58
+ }
@@ -0,0 +1 @@
1
+ "a0b83dd2802744bc7df9fd0093b84207"
@@ -0,0 +1,20 @@
1
+ {
2
+ "isDraft": false,
3
+ "isBeta": true,
4
+ "friendlyName": "X Ads - Web Conversions",
5
+ "description": "X Ads is a digital advertising platform designed to help businesses reach and engage with their target audiences on X, formerly known as Twitter.",
6
+ "logo": "https://cdn.metarouter.io/x-ads.png",
7
+ "color": "#000000",
8
+ "eventSource": {
9
+ "isAndroidApp": false,
10
+ "isIosApp": false,
11
+ "isWebApp": true
12
+ },
13
+ "inputSchema": "analytics_js",
14
+ "releaseNotes": [
15
+ {
16
+ "date": "2024-09-04T21:00:00.000Z",
17
+ "note": "Version: 0.1.0\nBeta Version\nX Ads initial release"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1 @@
1
+ "66f4857c48ea8e9dc8c174e4c57e53ec"
@@ -0,0 +1,167 @@
1
+ {
2
+ "version": "0.1.0",
3
+ "default": {
4
+ "enrichments": [
5
+ {
6
+ "staticString": "ADD_CATCH_ALL_EVENT_ID_HERE",
7
+ "outputKey": "event_id"
8
+ }
9
+ ]
10
+ },
11
+ "global": {
12
+ "mappings": [
13
+ {
14
+ "inputKey": "messageId",
15
+ "outputKey": "conversion_id"
16
+ },
17
+ {
18
+ "inputKey": "timestamp",
19
+ "outputKey": "conversion_time"
20
+ },
21
+ {
22
+ "inputKey": "input",
23
+ "outputKey": "identifiers",
24
+ "transforms": [
25
+ {
26
+ "expression": {
27
+ "lang": "lua",
28
+ "body": "local identifiers = {}\n\nlocal email = input.traits.email or input.context.traits.email\nif (email) then\n table.insert(identifiers, { hashed_email = TO_SHA256_HASH(LOWER(TRIM(email))) })\nend\n\nlocal phone = input.traits.phone or input.context.traits.phone\nif (phone) then\n table.insert(identifiers, { hashed_phone_number = TO_SHA256_HASH(LOWER(TRIM(phone))) })\nend\n\nif (input.context.providers.xAds.twclid) then\n table.insert(identifiers, { twclid = input.context.providers.xAds.twclid })\nend\nif (input.context.ip or input.context.userAgent) then\n table.insert(identifiers, {\n ip_address = input.context.ip,\n user_agent = input.context.userAgent\n })\nend\n\nif #identifiers > 0 then\n return identifiers\nend"
29
+ }
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "inputKey": "input",
35
+ "outputKey": "number_items",
36
+ "transforms": [
37
+ {
38
+ "expression": {
39
+ "lang": "lua",
40
+ "body": "if input.properties.products then\n return SUM(MAP(input.properties.products, function (p) return p.quantity or 1 end))\nelseif input.properties.sku then\n return 1\nend"
41
+ }
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "inputKey": "input",
47
+ "outputKey": "price_currency",
48
+ "transforms": [
49
+ {
50
+ "expression": {
51
+ "lang": "lua",
52
+ "body": "local currency = input.properties.currency\nif currency then\n return UPPER(currency)\nend"
53
+ }
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "inputKey": "input",
59
+ "outputKey": "value",
60
+ "transforms": [
61
+ {
62
+ "expression": {
63
+ "lang": "lua",
64
+ "body": "local value = 0\nif input.properties.products then\n value = SUM(MAP(input.properties.products, function (p)\n return (p.price or 0) * (p.quantity or 1)\n end))\nelseif input.properties.sku then\n value = (input.properties.price or 0) * (input.properties.quantity or 1)\nelse\n return\nend\nreturn string.format(\"%.2f\", value)"
65
+ }
66
+ }
67
+ ]
68
+ },
69
+ {
70
+ "inputKey": "input",
71
+ "outputKey": "description",
72
+ "transforms": [
73
+ {
74
+ "expression": {
75
+ "lang": "lua",
76
+ "body": "if input.type == 'track' then\n return input.event\nend\nreturn input.type"
77
+ }
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ "inputKey": "input",
83
+ "outputKey": "contents",
84
+ "transforms": [
85
+ {
86
+ "expression": {
87
+ "lang": "lua",
88
+ "body": "local function get_content(p)\n if not p.sku then\n return nil\n end\n\n return {\n content_id = p.sku,\n content_name = p.name,\n content_price = string.format(\"%.2f\", p.price),\n content_type = p.category,\n num_items = p.quantity\n }\nend\n\nlocal prods = input.properties.products or {input.properties}\nlocal contents = MAP(prods, get_content)\nif #contents > 0 then\n return contents\nend"
89
+ }
90
+ }
91
+ ]
92
+ }
93
+ ]
94
+ },
95
+ "eventSpecific": {
96
+ "page": {
97
+ "enrichments": [
98
+ {
99
+ "staticString": "ADD_EVENT_ID_HERE",
100
+ "outputKey": "event_id"
101
+ }
102
+ ]
103
+ },
104
+ "checkout_started": {
105
+ "enrichments": [
106
+ {
107
+ "staticString": "ADD_EVENT_ID_HERE",
108
+ "outputKey": "event_id"
109
+ }
110
+ ]
111
+ },
112
+ "order_completed": {
113
+ "enrichments": [
114
+ {
115
+ "staticString": "ADD_EVENT_ID_HERE",
116
+ "outputKey": "event_id"
117
+ }
118
+ ]
119
+ },
120
+ "payment_info_entered": {
121
+ "enrichments": [
122
+ {
123
+ "staticString": "ADD_EVENT_ID_HERE",
124
+ "outputKey": "event_id"
125
+ }
126
+ ]
127
+ },
128
+ "product_added": {
129
+ "enrichments": [
130
+ {
131
+ "staticString": "ADD_EVENT_ID_HERE",
132
+ "outputKey": "event_id"
133
+ }
134
+ ]
135
+ },
136
+ "product_added_to_wishlist": {
137
+ "enrichments": [
138
+ {
139
+ "staticString": "ADD_EVENT_ID_HERE",
140
+ "outputKey": "event_id"
141
+ }
142
+ ]
143
+ },
144
+ "product_viewed": {
145
+ "enrichments": [
146
+ {
147
+ "staticString": "ADD_EVENT_ID_HERE",
148
+ "outputKey": "event_id"
149
+ }
150
+ ]
151
+ },
152
+ "products_searched": {
153
+ "enrichments": [
154
+ {
155
+ "staticString": "ADD_EVENT_ID_HERE",
156
+ "outputKey": "event_id"
157
+ }
158
+ ],
159
+ "mappings": [
160
+ {
161
+ "inputKey": "properties.query",
162
+ "outputKey": "search_string"
163
+ }
164
+ ]
165
+ }
166
+ }
167
+ }
package/README.md CHANGED
@@ -9,6 +9,7 @@ previously.
9
9
  - ActionIQ
10
10
  - TikTok
11
11
  - VideoAmp (BETA)
12
+ - X Ads - Web Conversions (BETA)
12
13
 
13
14
  ## 2024-08
14
15
  - Adobe Analytics - Experience (BETA)
@@ -98,6 +99,7 @@ previously.
98
99
  | ActionIQ | 2024-09 | Version: 1.1.0 Added endpoint details for screen events Added screen event mappings to the playbook |
99
100
  | TikTok | 2024-09 | Version: 2.1.0 Stable release |
100
101
  | VideoAmp (BETA) | 2024-09 | Version 0.2.0 Added new GPP related mappings |
102
+ | X Ads - Web Conversions (BETA) | 2024-09 | Version: 0.1.0 Beta Version X Ads initial release |
101
103
  | Adobe Analytics - Experience (BETA) | 2024-08 | Version: 0.3.0 Removing Bearer Header Adding oAuth Updated friendly name |
102
104
  | AppsFlyer Android | 2024-08 | Version 1.1.0 timestamp field is used as the event time |
103
105
  | AppsFlyer iOS | 2024-08 | Version 1.1.0 timestamp field is used as the event time |
package/index.js CHANGED
@@ -417,6 +417,12 @@ exports.videoamp = {
417
417
  metadata: require('./.dist/videoamp/metadata.json')
418
418
  }
419
419
 
420
+ exports['x-ads'] = {
421
+ endpointSchema: require('./.dist/x-ads/connection.json'),
422
+ playbook: require('./.dist/x-ads/playbook.json'),
423
+ metadata: require('./.dist/x-ads/metadata.json')
424
+ }
425
+
420
426
  exports.xandr = {
421
427
  endpointSchema: require('./.dist/xandr/connection.json'),
422
428
  playbook: require('./.dist/xandr/playbook.json'),
@@ -779,6 +785,11 @@ exports.etags = {
779
785
  playbook: require('./.dist/videoamp/playbook.etag.json'),
780
786
  kit: require('./.dist/videoamp/kit.etag.json')
781
787
  },
788
+ 'x-ads': {
789
+ endpointSchema: require('./.dist/x-ads/connection.etag.json'),
790
+ playbook: require('./.dist/x-ads/playbook.etag.json'),
791
+ kit: require('./.dist/x-ads/kit.etag.json')
792
+ },
782
793
  xandr: {
783
794
  endpointSchema: require('./.dist/xandr/connection.etag.json'),
784
795
  playbook: require('./.dist/xandr/playbook.etag.json'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metarouter/ajs-starter-kit",
3
- "version": "1.0.104",
3
+ "version": "1.0.105",
4
4
  "description": "MetaRouter analytics.js starter kit",
5
5
  "main": "index.js",
6
6
  "scripts": {