@segment/analytics-browser-actions-facebook-conversions-api-web 1.9.1-staging-99a2d468f.1 → 1.11.0

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.
Files changed (55) hide show
  1. package/dist/cjs/functions.d.ts +0 -1
  2. package/dist/cjs/functions.js +2 -11
  3. package/dist/cjs/functions.js.map +1 -1
  4. package/dist/cjs/generated-types.d.ts +1 -0
  5. package/dist/cjs/index.d.ts +6 -2
  6. package/dist/cjs/index.js +17 -5
  7. package/dist/cjs/index.js.map +1 -1
  8. package/dist/cjs/send/depends-on.js +11 -40
  9. package/dist/cjs/send/depends-on.js.map +1 -1
  10. package/dist/cjs/send/fields.js +18 -5
  11. package/dist/cjs/send/fields.js.map +1 -1
  12. package/dist/cjs/send/functions.d.ts +2 -2
  13. package/dist/cjs/send/functions.js +40 -29
  14. package/dist/cjs/send/functions.js.map +1 -1
  15. package/dist/cjs/send/generated-types.d.ts +2 -0
  16. package/dist/cjs/send/index.d.ts +5 -2
  17. package/dist/cjs/send/index.js +1 -1
  18. package/dist/cjs/send/index.js.map +1 -1
  19. package/dist/cjs/types.d.ts +10 -0
  20. package/dist/cjs/types.js.map +1 -1
  21. package/dist/esm/functions.d.ts +0 -1
  22. package/dist/esm/functions.js +2 -10
  23. package/dist/esm/functions.js.map +1 -1
  24. package/dist/esm/generated-types.d.ts +1 -0
  25. package/dist/esm/index.d.ts +6 -2
  26. package/dist/esm/index.js +17 -5
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/send/depends-on.js +11 -40
  29. package/dist/esm/send/depends-on.js.map +1 -1
  30. package/dist/esm/send/fields.js +18 -5
  31. package/dist/esm/send/fields.js.map +1 -1
  32. package/dist/esm/send/functions.d.ts +2 -2
  33. package/dist/esm/send/functions.js +40 -29
  34. package/dist/esm/send/functions.js.map +1 -1
  35. package/dist/esm/send/generated-types.d.ts +2 -0
  36. package/dist/esm/send/index.d.ts +5 -2
  37. package/dist/esm/send/index.js +1 -1
  38. package/dist/esm/send/index.js.map +1 -1
  39. package/dist/esm/types.d.ts +10 -0
  40. package/dist/esm/types.js.map +1 -1
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +3 -3
  43. package/src/__tests__/functions.test.ts +159 -0
  44. package/src/constants.ts +1 -1
  45. package/src/functions.ts +66 -65
  46. package/src/generated-types.ts +4 -0
  47. package/src/index.ts +43 -26
  48. package/src/send/__tests__/depends-on.test.ts +28 -0
  49. package/src/send/__tests__/functions.test.ts +1178 -0
  50. package/src/send/depends-on.ts +41 -69
  51. package/src/send/fields.ts +304 -299
  52. package/src/send/functions.ts +213 -153
  53. package/src/send/generated-types.ts +10 -2
  54. package/src/send/index.ts +4 -4
  55. package/src/types.ts +33 -21
@@ -3,361 +3,366 @@ import { getDependenciesFor } from './depends-on'
3
3
  import { CURRENCY_ISO_CODES } from '../constants'
4
4
 
5
5
  export const event_config: InputField = {
6
- label: 'Event Configuration',
7
- description: 'Specify the type of Facebook Conversions API event to send.',
8
- type: 'object',
9
- required: true,
10
- additionalProperties: false,
11
- defaultObjectUI: 'keyvalue',
12
- properties: {
13
- event_name: {
14
- label: 'Event Name',
15
- description: "Facebook Conversions API Event Name to send. Select 'Custom Event' to send a non standard event.",
16
- type: 'string',
17
- required: true,
18
- choices: [
19
- { label: 'Custom Event', value: 'CustomEvent' },
20
- { label: 'Page View', value: 'PageView' },
21
- { label: 'Add Payment Info', value: 'AddPaymentInfo' },
22
- { label: 'Add To Cart', value: 'AddToCart' },
23
- { label: 'Add To Wishlist', value: 'AddToWishlist' },
24
- { label: 'Complete Registration', value: 'CompleteRegistration' },
25
- { label: 'Contact', value: 'Contact' },
26
- { label: 'Customize Product', value: 'CustomizeProduct' },
27
- { label: 'Donate', value: 'Donate' },
28
- { label: 'Find Location', value: 'FindLocation' },
29
- { label: 'Initiate Checkout', value: 'InitiateCheckout' },
30
- { label: 'Lead', value: 'Lead' },
31
- { label: 'Purchase', value: 'Purchase' },
32
- { label: 'Schedule', value: 'Schedule' },
33
- { label: 'Search', value: 'Search' },
34
- { label: 'Start Trial', value: 'StartTrial' },
35
- { label: 'Submit Application', value: 'SubmitApplication' },
36
- { label: 'Subscribe', value: 'Subscribe' },
37
- { label: 'View Content', value: 'ViewContent' }
38
- ]
6
+ label: 'Event Configuration',
7
+ description: 'Specify the type of Facebook Conversions API event to send.',
8
+ type: 'object',
9
+ required: true,
10
+ additionalProperties: false,
11
+ defaultObjectUI: 'keyvalue',
12
+ properties: {
13
+ event_name: {
14
+ label: 'Event Name',
15
+ description: "Facebook Conversions API Event Name to send. Select 'Custom Event' to send a non standard event.",
16
+ type: 'string',
17
+ required: true,
18
+ choices: [
19
+ { label: 'Custom Event', value: 'CustomEvent' },
20
+ { label: 'Page View', value: 'PageView' },
21
+ { label: 'Add Payment Info', value: 'AddPaymentInfo' },
22
+ { label: 'Add To Cart', value: 'AddToCart' },
23
+ { label: 'Add To Wishlist', value: 'AddToWishlist' },
24
+ { label: 'Complete Registration', value: 'CompleteRegistration' },
25
+ { label: 'Contact', value: 'Contact' },
26
+ { label: 'Customize Product', value: 'CustomizeProduct' },
27
+ { label: 'Donate', value: 'Donate' },
28
+ { label: 'Find Location', value: 'FindLocation' },
29
+ { label: 'Initiate Checkout', value: 'InitiateCheckout' },
30
+ { label: 'Lead', value: 'Lead' },
31
+ { label: 'Purchase', value: 'Purchase' },
32
+ { label: 'Schedule', value: 'Schedule' },
33
+ { label: 'Search', value: 'Search' },
34
+ { label: 'Start Trial', value: 'StartTrial' },
35
+ { label: 'Submit Application', value: 'SubmitApplication' },
36
+ { label: 'Subscribe', value: 'Subscribe' },
37
+ { label: 'View Content', value: 'ViewContent' }
38
+ ]
39
+ },
40
+ custom_event_name:{
41
+ label: 'Custom Event Name',
42
+ description: 'Custom event name to send to Facebook',
43
+ type: 'string',
44
+ depends_on: getDependenciesFor('custom_event_name')
45
+ },
46
+ show_fields: {
47
+ label: 'Show all fields',
48
+ description: 'Show all fields, even those which are not relevant to the selected Event Name.',
49
+ type: 'boolean',
50
+ default: false
51
+ }
39
52
  },
40
- custom_event_name: {
41
- label: 'Custom Event Name',
42
- description: 'Custom event name to send to Facebook',
43
- type: 'string',
44
- depends_on: getDependenciesFor('custom_event_name')
45
- },
46
- show_fields: {
47
- label: 'Show all fields',
48
- description: 'Show all fields, even those which are not relevant to the selected Event Name.',
49
- type: 'boolean',
50
- default: false
53
+ default: {
54
+ event_name: 'CustomEvent',
55
+ custom_event_name: {'@path': '$.event'},
56
+ show_fields: false
51
57
  }
52
- },
53
- default: {
54
- event_name: 'CustomEvent',
55
- custom_event_name: { '@path': '$.event' },
56
- show_fields: false
57
- }
58
58
  }
59
59
 
60
60
  export const content_category: InputField = {
61
- label: 'Content Category',
62
- description: 'The category of the content associated with the event.',
63
- type: 'string',
64
- default: { '@path': '$.properties.category' },
65
- depends_on: getDependenciesFor('content_category')
61
+ label: 'Content Category',
62
+ description: 'The category of the content associated with the event.',
63
+ type: 'string',
64
+ default: { '@path': '$.properties.category' },
65
+ depends_on: getDependenciesFor('content_category')
66
66
  }
67
67
 
68
68
  export const content_name: InputField = {
69
- label: 'Content Name',
70
- description: 'The name of the page or product associated with the event.',
71
- type: 'string',
72
- default: { '@path': '$.properties.name' },
73
- depends_on: getDependenciesFor('content_name')
69
+ label: 'Content Name',
70
+ description: 'The name of the page or product associated with the event.',
71
+ type: 'string',
72
+ default: { '@path': '$.properties.name' },
73
+ depends_on: getDependenciesFor('content_name')
74
74
  }
75
75
 
76
76
  export const content_type: InputField = {
77
- label: 'Content Type',
78
- description:
79
- 'If the IDs being passed in content_ids or contents parameter are IDs of products, then the value should be product. If product group IDs are being passed, then the value should be product_group. If no content_type is provided, Meta will match the event to every item that has the same ID, independent of its type.',
80
- type: 'string',
81
- choices: [
82
- { value: 'product', label: 'Product' },
83
- { value: 'product_group', label: 'Product Group' }
84
- ],
85
- default: 'product',
86
- depends_on: getDependenciesFor('content_type')
77
+ label: 'Content Type',
78
+ description:
79
+ 'If the IDs being passed in content_ids or contents parameter are IDs of products, then the value should be product. If product group IDs are being passed, then the value should be product_group. If no content_type is provided, Meta will match the event to every item that has the same ID, independent of its type.',
80
+ type: 'string',
81
+ choices: [
82
+ { value: 'product', label: 'Product' },
83
+ { value: 'product_group', label: 'Product Group' }
84
+ ],
85
+ default: 'product',
86
+ depends_on: getDependenciesFor('content_type')
87
87
  }
88
88
 
89
89
  export const content_ids: InputField = {
90
- label: 'Content IDs',
91
- description:
92
- "Product IDs associated with the event, such as SKUs (e.g. ['ABC123', 'XYZ789']). Accepts a single string value or array of strings.",
93
- type: 'string',
94
- multiple: true,
95
- default: { '@liquid': "{{ properties.products | map: 'product_id' }}" },
96
- depends_on: getDependenciesFor('content_ids')
90
+ label: 'Content IDs',
91
+ description: "Product IDs associated with the event, such as SKUs (e.g. ['ABC123', 'XYZ789']). Accepts a single string value or array of strings.",
92
+ type: 'string',
93
+ multiple: true,
94
+ default: { "@liquid": "{{ properties.products | map: 'product_id' }}"}
95
+ ,
96
+ depends_on: getDependenciesFor('content_ids')
97
97
  }
98
98
 
99
99
  export const contents: InputField = {
100
- label: 'Contents',
101
- description:
102
- 'A list of JSON objects that contain the product IDs associated with the event plus information about the products. ID and quantity are required fields.',
103
- type: 'object',
104
- multiple: true,
105
- additionalProperties: true,
106
- defaultObjectUI: 'keyvalue',
107
- properties: {
108
- id: {
109
- label: 'ID',
110
- description: 'The product ID of the purchased item.',
111
- type: 'string',
112
- required: true
100
+ label: 'Contents',
101
+ description: 'A list of JSON objects that contain the product IDs associated with the event plus information about the products. ID and quantity are required fields.',
102
+ type: 'object',
103
+ multiple: true,
104
+ additionalProperties: true,
105
+ defaultObjectUI: 'keyvalue',
106
+ properties: {
107
+ id: {
108
+ label: 'ID',
109
+ description: 'The product ID of the purchased item.',
110
+ type: 'string',
111
+ required: true
112
+ },
113
+ quantity: {
114
+ label: 'Quantity',
115
+ description: 'The number of items purchased.',
116
+ type: 'integer',
117
+ required: true
118
+ },
119
+ item_price: {
120
+ label: 'Item Price',
121
+ description: 'The price of the item.',
122
+ type: 'number'
123
+ }
113
124
  },
114
- quantity: {
115
- label: 'Quantity',
116
- description: 'The number of items purchased.',
117
- type: 'integer',
118
- required: true
125
+ default: {
126
+ '@arrayPath': [
127
+ '$.properties.products',
128
+ {
129
+ id: { '@path': '$.product_id' },
130
+ quantity: { '@path': '$.quantity' },
131
+ item_price: { '@path': '$.price' }
132
+ }
133
+ ]
119
134
  },
120
- item_price: {
121
- label: 'Item Price',
122
- description: 'The price of the item.',
123
- type: 'number'
124
- }
125
- },
126
- default: {
127
- '@arrayPath': [
128
- '$.properties.products',
129
- {
130
- id: { '@path': '$.product_id' },
131
- quantity: { '@path': '$.quantity' },
132
- item_price: { '@path': '$.price' }
133
- }
134
- ]
135
- },
136
- depends_on: getDependenciesFor('contents')
137
- }
135
+ depends_on: getDependenciesFor('contents')
136
+ }
138
137
 
139
138
  export const currency: InputField = {
140
- label: 'Currency',
141
- description: 'The currency for the value specified. Currency must be a valid ISO 4217 three-digit currency code.',
142
- type: 'string',
143
- default: { '@path': '$.properties.currency' },
144
- depends_on: getDependenciesFor('currency'),
145
- choices: (() => {
146
- return [...CURRENCY_ISO_CODES].map((code) => ({
147
- value: code,
148
- label: code
149
- }))
150
- })(),
151
- required: {
152
- match: 'all',
153
- conditions: [
154
- {
155
- fieldKey: 'event_config.event_name',
156
- operator: 'is',
157
- value: 'Purchase'
158
- }
159
- ]
160
- }
139
+ label: 'Currency',
140
+ description: 'The currency for the value specified. Currency must be a valid ISO 4217 three-digit currency code.',
141
+ type: 'string',
142
+ default: { '@path': '$.properties.currency' },
143
+ depends_on: getDependenciesFor('currency'),
144
+ choices:(() => {
145
+ return [...CURRENCY_ISO_CODES].map(code => ({
146
+ value: code,
147
+ label: code
148
+ }))
149
+ })(),
150
+ required: {
151
+ match: 'all',
152
+ conditions: [
153
+ {
154
+ fieldKey: 'event_config.event_name',
155
+ operator: 'is',
156
+ value: 'Purchase'
157
+ }
158
+ ]
159
+ }
161
160
  }
162
161
 
163
162
  export const delivery_category: InputField = {
164
- label: 'Delivery Category',
165
- description: 'Category of the delivery',
166
- type: 'string',
167
- choices: [
168
- { value: 'in_store', label: 'In Store' },
169
- { value: 'curbside', label: 'Curbside' },
170
- { value: 'home_delivery', label: 'Home Delivery' }
171
- ],
172
- depends_on: getDependenciesFor('delivery_category')
163
+ label: 'Delivery Category',
164
+ description: 'Category of the delivery',
165
+ type: 'string',
166
+ choices: [
167
+ { value: 'in_store', label: 'In Store' },
168
+ { value: 'curbside', label: 'Curbside' },
169
+ { value: 'home_delivery', label: 'Home Delivery' }
170
+ ],
171
+ depends_on: getDependenciesFor('delivery_category')
173
172
  }
174
173
 
175
174
  export const num_items: InputField = {
176
- label: 'Number of Items',
177
- description: 'The number of items when checkout was initiated.',
178
- type: 'integer',
179
- default: { '@path': '$.properties.num_items' },
180
- depends_on: getDependenciesFor('num_items')
175
+ label: 'Number of Items',
176
+ description: 'The number of items when checkout was initiated.',
177
+ type: 'integer',
178
+ default: { '@path': '$.properties.num_items' },
179
+ depends_on: getDependenciesFor('num_items')
181
180
  }
182
181
 
183
182
  export const predicted_ltv: InputField = {
184
- label: 'Predicted LTV',
185
- description: 'Predicted lifetime value of a subscriber as defined by the advertiser and expressed as an exact value.',
186
- type: 'number',
187
- depends_on: getDependenciesFor('predicted_ltv')
183
+ label: 'Predicted LTV',
184
+ description: 'Predicted lifetime value of a subscriber as defined by the advertiser and expressed as an exact value.',
185
+ type: 'number',
186
+ depends_on: getDependenciesFor('predicted_ltv')
188
187
  }
189
188
 
190
189
  export const net_revenue: InputField = {
191
- label: 'Net Revenue',
192
- description: 'The net revenue associated with the purchase.',
193
- type: 'number',
194
- default: { '@path': '$.properties.net_revenue' },
195
- depends_on: getDependenciesFor('net_revenue')
190
+ label: 'Net Revenue',
191
+ description: 'The net revenue associated with the purchase.',
192
+ type: 'number',
193
+ default: { '@path': '$.properties.net_revenue' },
194
+ depends_on: getDependenciesFor('net_revenue')
196
195
  }
197
196
 
198
197
  export const search_string: InputField = {
199
- label: 'Search String',
200
- description: 'The string entered by the user for the search.',
201
- type: 'string',
202
- default: { '@path': '$.properties.query' },
203
- depends_on: getDependenciesFor('search_string')
198
+ label: 'Search String',
199
+ description: 'The string entered by the user for the search.',
200
+ type: 'string',
201
+ default: { '@path': '$.properties.query' },
202
+ depends_on: getDependenciesFor('search_string')
204
203
  }
205
204
 
206
205
  export const status: InputField = {
207
- label: 'Registration Status',
208
- description: 'The status of the registration. true for completed registrations, false otherwise.',
209
- type: 'boolean',
210
- depends_on: getDependenciesFor('status')
206
+ label: 'Registration Status',
207
+ description: 'The status of the registration. true for completed registrations, false otherwise.',
208
+ type: 'boolean',
209
+ depends_on: getDependenciesFor('status')
211
210
  }
212
211
 
213
212
  export const value: InputField = {
214
- label: 'Value',
215
- description:
216
- 'A numeric value associated with this event. This could be a monetary value or a value in some other metric.',
217
- type: 'number',
218
- default: { '@path': '$.properties.value' },
219
- depends_on: getDependenciesFor('value'),
220
- required: {
221
- match: 'all',
222
- conditions: [
223
- {
224
- fieldKey: 'event_config.event_name',
225
- operator: 'is',
226
- value: 'Purchase'
227
- }
228
- ]
229
- }
213
+ label: 'Value',
214
+ description: 'A numeric value associated with this event. This could be a monetary value or a value in some other metric.',
215
+ type: 'number',
216
+ default: { '@path': '$.properties.value' },
217
+ depends_on: getDependenciesFor('value'),
218
+ required: {
219
+ match: 'all',
220
+ conditions: [
221
+ {
222
+ fieldKey: 'event_config.event_name',
223
+ operator: 'is',
224
+ value: 'Purchase'
225
+ }
226
+ ]
227
+ }
230
228
  }
231
229
 
232
230
  export const custom_data: InputField = {
233
- label: 'Custom Data',
234
- description: 'The custom data object can be used to pass custom properties.',
235
- type: 'object',
236
- additionalProperties: true,
237
- defaultObjectUI: 'keyvalue'
231
+ label: 'Custom Data',
232
+ description: 'The custom data object can be used to pass custom properties.',
233
+ type: 'object',
234
+ additionalProperties: true,
235
+ defaultObjectUI: 'keyvalue'
238
236
  }
239
237
 
240
238
  export const eventID: InputField = {
241
- label: 'Event ID',
242
- description:
243
- 'This ID can be any unique string. Event ID is used to deduplicate events sent both the server side Conversions API and the browser Pixel.',
244
- type: 'string',
245
- default: { '@path': '$.messageId' }
239
+ label: 'Event ID',
240
+ description: 'This ID can be any unique string. Event ID is used to deduplicate events sent both the server side Conversions API and the browser Pixel.',
241
+ type: 'string',
242
+ default: { '@path': '$.messageId' }
246
243
  }
247
244
 
248
245
  export const eventSourceUrl: InputField = {
249
- label: 'Event Source URL',
250
- description:
251
- 'The URL of the page where the event occurred. Can be used to override the default URL taken from the current page.',
252
- type: 'string',
253
- default: { '@path': '$.context.page.url' }
246
+ label: 'Event Source URL',
247
+ description: 'The URL of the page where the event occurred. Can be used to override the default URL taken from the current page.',
248
+ type: 'string',
249
+ default: { '@path': '$.context.page.url' }
254
250
  }
255
251
 
256
252
  export const userData: InputField = {
257
- label: 'User Data',
258
- description:
259
- 'User data to be sent with the event. This can include hashed identifiers like email, phone number, etc.',
260
- type: 'object',
261
- additionalProperties: false,
262
- defaultObjectUI: 'keyvalue',
263
- properties: {
264
- external_id: {
265
- label: 'External ID',
266
- description: 'A unique identifier for the user from your system',
267
- type: 'string'
268
- },
269
- em: {
270
- label: 'Email',
271
- description: 'Email address of the user',
272
- type: 'string',
273
- format: 'email'
274
- },
275
- ph: {
276
- label: 'Phone Number',
277
- description: 'Phone number of the user',
278
- type: 'string'
279
- },
280
- fn: {
281
- label: 'First Name',
282
- description: 'First name of the user',
283
- type: 'string'
253
+ label: 'User Data',
254
+ description: 'User data to be sent with the event. This can include hashed identifiers like email, phone number, etc.',
255
+ type: 'object',
256
+ additionalProperties: false,
257
+ defaultObjectUI: 'keyvalue',
258
+ properties: {
259
+ external_id: {
260
+ label: 'External ID',
261
+ description: 'A unique identifier for the user from your system',
262
+ type: 'string'
263
+ },
264
+ em: {
265
+ label: 'Email',
266
+ description: 'Email address of the user',
267
+ type: 'string',
268
+ format: 'email'
269
+ },
270
+ ph: {
271
+ label: 'Phone Number',
272
+ description: 'Phone number of the user. Make sure to include the country code. For example, "15551234567" for a US number.',
273
+ type: 'string'
274
+ },
275
+ fn: {
276
+ label: 'First Name',
277
+ description: 'First name of the user',
278
+ type: 'string'
279
+ },
280
+ ln: {
281
+ label: 'Last Name',
282
+ description: 'Last name of the user',
283
+ type: 'string'
284
+ },
285
+ ge: {
286
+ label: 'Gender',
287
+ description: 'Gender of the user. If unknown leave blank.',
288
+ type: 'string',
289
+ choices: [
290
+ { label: 'Male', value: 'm' },
291
+ { label: 'Female', value: 'f' }
292
+ ]
293
+ },
294
+ db: {
295
+ label: 'Date of Birth',
296
+ description: 'Date of birth of the user',
297
+ type: 'string',
298
+ format: 'date'
299
+ },
300
+ ct: {
301
+ label: 'City',
302
+ description: 'City of the user',
303
+ type: 'string'
304
+ },
305
+ st: {
306
+ label: 'State',
307
+ description: 'State of the user. Facebook expects the 2-letter abbreviation for US states. For example, "CA" for California, or "NY" for New York.',
308
+ type: 'string'
309
+ },
310
+ zp: {
311
+ label: 'ZIP/Postal Code',
312
+ description: 'ZIP or postal code of the user. For example, U.S zip code: 94035, Australia zip code: 1987, France zip code: 75018, UK zip code: m11ae.',
313
+ type: 'string'
314
+ },
315
+ country: {
316
+ label: 'Country',
317
+ description: 'The country of the user. Facebook expects the 2-letter ISO 3166-1 alpha-2 country code. For example, "US" for the United States, or "GB" for the United Kingdom.',
318
+ type: 'string'
319
+ },
320
+ fbp: {
321
+ label: 'FBP',
322
+ description: 'Use this field to pass the Facebook browser cookie value (_fbp) associated with the user. If the "Format User Data with Parameter Builder" setting is enabled, Segment will automatically capture this value from the _fbp cookie.',
323
+ type: 'string'
324
+ },
325
+ fbc: {
326
+ label: 'FBC',
327
+ description: 'Use this field to pass The Facebook browser cookie value (_fbc) associated with the user. If the "Format User Data with Parameter Builder" setting is enabled, Segment will automatically capture this value from the _fbc cookie.',
328
+ type: 'string'
329
+ }
284
330
  },
285
- ln: {
286
- label: 'Last Name',
287
- description: 'Last name of the user',
288
- type: 'string'
289
- },
290
- ge: {
291
- label: 'Gender',
292
- description: 'Gender of the user. If unknown leave blank.',
293
- type: 'string',
294
- choices: [
295
- { label: 'Male', value: 'm' },
296
- { label: 'Female', value: 'f' }
297
- ]
298
- },
299
- db: {
300
- label: 'Date of Birth',
301
- description: 'Date of birth of the user',
302
- type: 'string',
303
- format: 'date'
304
- },
305
- ct: {
306
- label: 'City',
307
- description: 'City of the user',
308
- type: 'string'
309
- },
310
- st: {
311
- label: 'State',
312
- description:
313
- 'State of the user. Facebook expects the 2-letter abbreviation for US states. For example, "CA" for California, or "NY" for New York.',
314
- type: 'string'
315
- },
316
- zp: {
317
- label: 'ZIP/Postal Code',
318
- description:
319
- 'ZIP or postal code of the user. For example, "94025" for Menlo Park, CA, or "10001" for New York City.',
320
- type: 'string'
321
- },
322
- country: {
323
- label: 'Country',
324
- description:
325
- 'The country of the user. Facebook expects the 2-letter ISO 3166-1 alpha-2 country code. For example, "US" for the United States, or "GB" for the United Kingdom.',
326
- type: 'string'
331
+ default: {
332
+ external_id: { '@path': '$.userId' },
333
+ em: { '@path': '$.context.traits.email' },
334
+ ph: { '@path': '$.context.traits.phone' },
335
+ fn: { '@path': '$.context.traits.first_name' },
336
+ ln: { '@path': '$.context.traits.last_name' },
337
+ ge: { '@path': '$.context.traits.gender' },
338
+ db: { '@path': '$.context.traits.birthday' },
339
+ ct: { '@path': '$.context.traits.address.city' },
340
+ st: { '@path': '$.context.traits.address.state' },
341
+ zp: { '@path': '$.context.traits.address.postal_code' },
342
+ country: { '@path': '$.context.traits.address.country' },
343
+ fbp: { '@path': '$.context.traits.fbp' },
344
+ fbc: { '@path': '$.context.traits.fbc' },
345
+ client_ip_address: { '@path': '$.context.traits.client_ip_address' }
327
346
  }
328
- },
329
- default: {
330
- external_id: { '@path': '$.userId' },
331
- em: { '@path': '$.context.traits.email' },
332
- ph: { '@path': '$.context.traits.phone' },
333
- fn: { '@path': '$.context.traits.first_name' },
334
- ln: { '@path': '$.context.traits.last_name' },
335
- ge: { '@path': '$.context.traits.gender' },
336
- db: { '@path': '$.context.traits.birthday' },
337
- ct: { '@path': '$.context.traits.address.city' },
338
- st: { '@path': '$.context.traits.address.state' },
339
- zp: { '@path': '$.context.traits.address.postal_code' },
340
- country: { '@path': '$.context.traits.address.country' }
341
- }
342
347
  }
343
348
 
344
349
  export const AllFields = {
345
- event_config,
346
- content_category,
347
- content_ids,
348
- content_name,
349
- content_type,
350
- contents,
351
- currency,
352
- delivery_category,
353
- num_items,
354
- predicted_ltv,
355
- net_revenue,
356
- search_string,
357
- status,
358
- value,
359
- custom_data,
360
- eventID,
361
- eventSourceUrl,
362
- userData
363
- }
350
+ event_config,
351
+ content_category,
352
+ content_ids,
353
+ content_name,
354
+ content_type,
355
+ contents,
356
+ currency,
357
+ delivery_category,
358
+ num_items,
359
+ predicted_ltv,
360
+ net_revenue,
361
+ search_string,
362
+ status,
363
+ value,
364
+ custom_data,
365
+ eventID,
366
+ eventSourceUrl,
367
+ userData
368
+ }