@walkeros/server-destination-meta 0.0.7
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.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/examples/index.d.mts +311 -0
- package/dist/examples/index.d.ts +311 -0
- package/dist/examples/index.js +157 -0
- package/dist/examples/index.mjs +136 -0
- package/dist/index.d.mts +347 -0
- package/dist/index.d.ts +347 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 elbWalker GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<p align="left">
|
|
2
|
+
<a href="https://elbwalker.com">
|
|
3
|
+
<img title="elbwalker" src='https://www.elbwalker.com/img/elbwalker_logo.png' width="256px"/>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
# Meta (CAPI) Destination for walkerOS
|
|
8
|
+
|
|
9
|
+
This package provides a Meta Conversion API (CAPI) destination for walkerOS. It
|
|
10
|
+
allows you to send events to the Meta Conversions API.
|
|
11
|
+
|
|
12
|
+
[View documentation](https://www.elbwalker.com/docs/destinations/server/meta/)
|
|
13
|
+
|
|
14
|
+
## Role in walkerOS Ecosystem
|
|
15
|
+
|
|
16
|
+
walkerOS follows a **source → collector → destination** architecture:
|
|
17
|
+
|
|
18
|
+
- **Sources**: Capture events from various environments (browser DOM, dataLayer,
|
|
19
|
+
server requests)
|
|
20
|
+
- **Collector**: Processes, validates, and routes events with consent awareness
|
|
21
|
+
- **Destinations**: Send processed events to analytics platforms (GA4, Meta,
|
|
22
|
+
custom APIs)
|
|
23
|
+
|
|
24
|
+
This Meta CAPI destination receives processed events from the walkerOS collector
|
|
25
|
+
and sends them server-to-server to Meta's Conversions API, providing enhanced
|
|
26
|
+
data accuracy and attribution for Meta advertising campaigns while bypassing
|
|
27
|
+
browser limitations.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm install @walkeros/server-destination-meta
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
Here's a basic example of how to use the Meta CAPI destination:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { elb } from '@walkeros/collector';
|
|
41
|
+
import { destinationMeta } from '@walkeros/server-destination-meta';
|
|
42
|
+
|
|
43
|
+
elb('walker destination', destinationMeta, {
|
|
44
|
+
custom: {
|
|
45
|
+
accessToken: 'YOUR_ACCESS_TOKEN',
|
|
46
|
+
pixelId: 'YOUR_PIXEL_ID',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Contribute
|
|
52
|
+
|
|
53
|
+
Feel free to contribute by submitting an
|
|
54
|
+
[issue](https://github.com/elbwalker/walkerOS/issues), starting a
|
|
55
|
+
[discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
|
|
56
|
+
[contact](https://calendly.com/elb-alexander/30min).
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
|
+
import { DestinationServer } from '@walkeros/server-core';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
namespace WalkerOS {
|
|
6
|
+
interface Elb extends Elb.RegisterDestination<Destination, Config> {
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface Destination extends DestinationServer.Destination<Settings, Mapping> {
|
|
11
|
+
init: DestinationServer.InitFn<Settings, Mapping>;
|
|
12
|
+
}
|
|
13
|
+
type Config = {
|
|
14
|
+
settings: Settings;
|
|
15
|
+
} & DestinationServer.Config<Settings, Mapping>;
|
|
16
|
+
interface Settings {
|
|
17
|
+
accessToken: string;
|
|
18
|
+
pixelId: string;
|
|
19
|
+
action_source?: ActionSource;
|
|
20
|
+
doNotHash?: string[];
|
|
21
|
+
test_event_code?: string;
|
|
22
|
+
url?: string;
|
|
23
|
+
user_data?: Mapping$1.Map;
|
|
24
|
+
}
|
|
25
|
+
interface Mapping {
|
|
26
|
+
}
|
|
27
|
+
type Rule = Mapping$1.Rule<Mapping>;
|
|
28
|
+
interface BodyParameters {
|
|
29
|
+
data: Array<ServerEventParameters>;
|
|
30
|
+
test_event_code?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Represents the top‑level parameters for a server event sent via Meta's Conversions API.
|
|
34
|
+
* https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event
|
|
35
|
+
*/
|
|
36
|
+
interface ServerEventParameters extends StandardParameters {
|
|
37
|
+
/** The event name or custom event identifier. Required for deduplication. */
|
|
38
|
+
event_name: EventName;
|
|
39
|
+
/** Unix timestamp (in seconds) when the event actually occurred. GMT timezone. */
|
|
40
|
+
event_time: number;
|
|
41
|
+
/** Map of customer information for matching (emails, phone, etc.). */
|
|
42
|
+
user_data: CustomerInformationParameters;
|
|
43
|
+
/** Additional business data about the event. */
|
|
44
|
+
custom_data?: Record<string, unknown>;
|
|
45
|
+
/** URL of the page where the event occurred. */
|
|
46
|
+
event_source_url?: string;
|
|
47
|
+
/** If true, exclude this event from ads optimization (only attribution). */
|
|
48
|
+
opt_out?: boolean;
|
|
49
|
+
/** Unique ID for deduplication across Pixel and CAPI. */
|
|
50
|
+
event_id?: string;
|
|
51
|
+
/** Source of the event (e.g., website, app). */
|
|
52
|
+
action_source: ActionSource;
|
|
53
|
+
/** Processing options (e.g., ['LDU'] for CCPA limited data use). */
|
|
54
|
+
data_processing_options?: DataProcessingOption[];
|
|
55
|
+
/** Country code for data processing option (1 = USA, 0 = auto‑geolocate). */
|
|
56
|
+
data_processing_options_country?: number;
|
|
57
|
+
/** State code for data processing option (1000 = California, 0 = auto). */
|
|
58
|
+
data_processing_options_state?: number;
|
|
59
|
+
/** App‑specific data (required if action_source is 'app'). */
|
|
60
|
+
app_data?: AppData;
|
|
61
|
+
/** HTTP referrer header of the event. */
|
|
62
|
+
referrer_url?: string;
|
|
63
|
+
/** Metadata to link delayed events to past acquisition events. */
|
|
64
|
+
original_event_data?: OriginalEventDataParameters;
|
|
65
|
+
/** User segment for more context about the customer's relationship. */
|
|
66
|
+
customer_segmentation?: CustomerSegmentation;
|
|
67
|
+
}
|
|
68
|
+
type EventName = 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
|
|
69
|
+
type ActionSource = 'email' | 'website' | 'app' | 'phone_call' | 'chat' | 'physical_store' | 'system_generated' | 'business_messaging' | 'other';
|
|
70
|
+
type DataProcessingOption = 'LDU';
|
|
71
|
+
type CustomerSegmentation = 'new_customer_to_business' | 'new_customer_to_business_line' | 'new_customer_to_product_area' | 'new_customer_to_medium' | 'existing_customer_to_business' | 'existing_customer_to_business_line' | 'existing_customer_to_product_area' | 'existing_customer_to_medium' | 'customer_in_loyalty_program';
|
|
72
|
+
/** Extended device info for app events (Android version 'a2', iOS 'i2') */
|
|
73
|
+
interface AppData {
|
|
74
|
+
/**
|
|
75
|
+
* Comma-separated array of strings with fixed order:
|
|
76
|
+
* [sdk_version, os_version, device_model, device_brand,
|
|
77
|
+
* screen_width, screen_height, ...]
|
|
78
|
+
*/
|
|
79
|
+
extinfo: string[];
|
|
80
|
+
}
|
|
81
|
+
interface CustomerInformationParameters {
|
|
82
|
+
/** Email(s), SHA-256 hashed, lowercase and trimmed */
|
|
83
|
+
em?: string | string[];
|
|
84
|
+
/** Phone number(s), SHA-256 hashed, E.164 format (no leading 0s or symbols) */
|
|
85
|
+
ph?: string | string[];
|
|
86
|
+
/** First name(s), SHA-256 hashed, lowercase */
|
|
87
|
+
fn?: string | string[];
|
|
88
|
+
/** Last name(s), SHA-256 hashed, lowercase */
|
|
89
|
+
ln?: string | string[];
|
|
90
|
+
/** Date(s) of birth in YYYYMMDD, SHA-256 hashed */
|
|
91
|
+
db?: string | string[];
|
|
92
|
+
/** Gender(s) in lowercase single letter ("m", "f", etc.), SHA-256 hashed */
|
|
93
|
+
ge?: string | string[];
|
|
94
|
+
/** City name(s), SHA-256 hashed, lowercase */
|
|
95
|
+
ct?: string | string[];
|
|
96
|
+
/** State abbreviation(s), SHA-256 hashed, lowercase (e.g., "ca", "ny") */
|
|
97
|
+
st?: string | string[];
|
|
98
|
+
/** ZIP or postal code(s), SHA-256 hashed, lowercase */
|
|
99
|
+
zp?: string | string[];
|
|
100
|
+
/** Country code(s), SHA-256 hashed, lowercase (ISO 3166-1 alpha-2) */
|
|
101
|
+
country?: string | string[];
|
|
102
|
+
/** External IDs, unique per user. SHA-256 hash recommended */
|
|
103
|
+
external_id?: string | string[];
|
|
104
|
+
/** IPv4 or IPv6 address of client. Do NOT hash. */
|
|
105
|
+
client_ip_address?: string;
|
|
106
|
+
/** User agent string from browser. Do NOT hash. */
|
|
107
|
+
client_user_agent?: string;
|
|
108
|
+
/** fbclid parameter value from the URL. Do NOT hash. */
|
|
109
|
+
fbclid?: string;
|
|
110
|
+
/** Facebook click ID (_fbc cookie). Do NOT hash. */
|
|
111
|
+
fbc?: string;
|
|
112
|
+
/** Facebook browser ID (_fbp cookie). Do NOT hash. */
|
|
113
|
+
fbp?: string;
|
|
114
|
+
/** Subscription ID for the transaction. Do NOT hash. */
|
|
115
|
+
subscription_id?: string;
|
|
116
|
+
/** Facebook login ID (App-Scoped ID). Do NOT hash. */
|
|
117
|
+
fb_login_id?: number;
|
|
118
|
+
/** Meta Lead Ad lead ID. Do NOT hash. */
|
|
119
|
+
lead_id?: number;
|
|
120
|
+
/** Anonymous install ID. App events only. Do NOT hash. */
|
|
121
|
+
anon_id?: string;
|
|
122
|
+
/** Mobile advertiser ID (GAID/IDFA). Do NOT hash. */
|
|
123
|
+
madid?: string;
|
|
124
|
+
/** Facebook Page ID. Do NOT hash. */
|
|
125
|
+
page_id?: string;
|
|
126
|
+
/** Messenger Page-scoped user ID. Do NOT hash. */
|
|
127
|
+
page_scoped_user_id?: string;
|
|
128
|
+
/** Click to WhatsApp ad click ID. Do NOT hash. */
|
|
129
|
+
ctwa_clid?: string;
|
|
130
|
+
/** Instagram business account ID. Do NOT hash. */
|
|
131
|
+
ig_account_id?: string;
|
|
132
|
+
/** Instagram-scoped user ID. Do NOT hash. */
|
|
133
|
+
ig_sid?: string;
|
|
134
|
+
}
|
|
135
|
+
interface StandardParameters {
|
|
136
|
+
availability?: string;
|
|
137
|
+
body_style?: string;
|
|
138
|
+
checkin_date?: string;
|
|
139
|
+
city?: string;
|
|
140
|
+
condition_of_vehicle?: string;
|
|
141
|
+
content_ids?: string[];
|
|
142
|
+
content_type?: 'product' | 'product_group' | string;
|
|
143
|
+
contents?: Array<{
|
|
144
|
+
id: string;
|
|
145
|
+
quantity?: number;
|
|
146
|
+
item_price?: number;
|
|
147
|
+
delivery_category?: string;
|
|
148
|
+
}>;
|
|
149
|
+
country?: string;
|
|
150
|
+
currency?: string;
|
|
151
|
+
delivery_category?: 'in_store' | 'curbside' | 'home_delivery' | string;
|
|
152
|
+
departing_arrival_date?: string;
|
|
153
|
+
departing_departure_date?: string;
|
|
154
|
+
destination_airport?: string;
|
|
155
|
+
destination_ids?: string[];
|
|
156
|
+
dma_code?: string;
|
|
157
|
+
drivetrain?: string;
|
|
158
|
+
exterior_color?: string;
|
|
159
|
+
fuel_type?: string;
|
|
160
|
+
hotel_score?: number;
|
|
161
|
+
interior_color?: string;
|
|
162
|
+
lead_event_source?: string;
|
|
163
|
+
lease_end_date?: string;
|
|
164
|
+
lease_start_date?: string;
|
|
165
|
+
listing_type?: string;
|
|
166
|
+
make?: string;
|
|
167
|
+
'mileage.unit'?: string;
|
|
168
|
+
'mileage.value'?: number;
|
|
169
|
+
model?: string;
|
|
170
|
+
neighborhood?: string;
|
|
171
|
+
net_revenue?: number;
|
|
172
|
+
num_adults?: number;
|
|
173
|
+
num_children?: number;
|
|
174
|
+
num_infants?: number;
|
|
175
|
+
num_items?: number;
|
|
176
|
+
order_id?: string;
|
|
177
|
+
origin_airport?: string;
|
|
178
|
+
postal_code?: string;
|
|
179
|
+
predicted_ltv?: number;
|
|
180
|
+
preferred_baths_range?: string;
|
|
181
|
+
preferred_beds_range?: string;
|
|
182
|
+
preferred_neighborhoods?: string[];
|
|
183
|
+
preferred_num_stops?: number;
|
|
184
|
+
preferred_price_range?: string;
|
|
185
|
+
preferred_star_ratings?: [number, number];
|
|
186
|
+
price?: string;
|
|
187
|
+
product_catalog_id?: string;
|
|
188
|
+
property_type?: string;
|
|
189
|
+
region?: string;
|
|
190
|
+
returning_arrival_date?: string;
|
|
191
|
+
returning_departure_date?: string;
|
|
192
|
+
search_string?: string;
|
|
193
|
+
state_of_vehicle?: string;
|
|
194
|
+
suggested_destinations?: string[];
|
|
195
|
+
suggested_home_listings?: string[];
|
|
196
|
+
suggested_hotels?: string[];
|
|
197
|
+
suggested_jobs?: string[];
|
|
198
|
+
suggested_local_service_businesses?: string[];
|
|
199
|
+
suggested_location_based_items?: string[];
|
|
200
|
+
suggested_vehicles?: string[];
|
|
201
|
+
transmission?: string;
|
|
202
|
+
travel_class?: string;
|
|
203
|
+
travel_end?: string;
|
|
204
|
+
travel_start?: string;
|
|
205
|
+
trim?: string;
|
|
206
|
+
fb_availability?: string;
|
|
207
|
+
fb_body_style?: string;
|
|
208
|
+
fb_checkin_date?: string;
|
|
209
|
+
fb_city?: string;
|
|
210
|
+
fb_condition_of_vehicle?: string;
|
|
211
|
+
fb_content_ids?: string[];
|
|
212
|
+
fb_content_type?: string;
|
|
213
|
+
fb_contents?: Array<{
|
|
214
|
+
id: string;
|
|
215
|
+
quantity?: number;
|
|
216
|
+
item_price?: number;
|
|
217
|
+
}>;
|
|
218
|
+
fb_country?: string;
|
|
219
|
+
fb_currency?: string;
|
|
220
|
+
fb_delivery_category?: string;
|
|
221
|
+
fb_departing_arrival_date?: string;
|
|
222
|
+
fb_departing_departure_date?: string;
|
|
223
|
+
fb_destination_airport?: string;
|
|
224
|
+
fb_destination_ids?: string[];
|
|
225
|
+
fb_dma_code?: string;
|
|
226
|
+
fb_drivetrain?: string;
|
|
227
|
+
fb_exterior_color?: string;
|
|
228
|
+
fb_fuel_type?: string;
|
|
229
|
+
fb_hotel_score?: number;
|
|
230
|
+
fb_interior_color?: string;
|
|
231
|
+
fb_lease_end_date?: string;
|
|
232
|
+
fb_lease_start_date?: string;
|
|
233
|
+
fb_listing_type?: string;
|
|
234
|
+
fb_make?: string;
|
|
235
|
+
'fb_mileage.unit'?: string;
|
|
236
|
+
'fb_mileage.value'?: number;
|
|
237
|
+
fb_model?: string;
|
|
238
|
+
fb_neighborhood?: string;
|
|
239
|
+
fb_num_adults?: number;
|
|
240
|
+
fb_num_children?: number;
|
|
241
|
+
fb_num_infants?: number;
|
|
242
|
+
fb_num_items?: number;
|
|
243
|
+
fb_order_id?: string;
|
|
244
|
+
fb_origin_airport?: string;
|
|
245
|
+
fb_postal_code?: string;
|
|
246
|
+
fb_predicted_ltv?: number;
|
|
247
|
+
fb_preferred_baths_range?: string;
|
|
248
|
+
fb_preferred_beds_range?: string;
|
|
249
|
+
fb_preferred_neighborhoods?: string[];
|
|
250
|
+
fb_preferred_num_stops?: number;
|
|
251
|
+
fb_preferred_price_range?: string;
|
|
252
|
+
fb_preferred_star_ratings?: [number, number];
|
|
253
|
+
fb_price?: string;
|
|
254
|
+
fb_product_catalog_id?: string;
|
|
255
|
+
fb_property_type?: string;
|
|
256
|
+
fb_region?: string;
|
|
257
|
+
fb_returning_arrival_date?: string;
|
|
258
|
+
fb_returning_departure_date?: string;
|
|
259
|
+
fb_search_string?: string;
|
|
260
|
+
fb_state_of_vehicle?: string;
|
|
261
|
+
fb_suggested_destinations?: string[];
|
|
262
|
+
fb_suggested_home_listings?: string[];
|
|
263
|
+
fb_suggested_hotels?: string[];
|
|
264
|
+
fb_suggested_jobs?: string[];
|
|
265
|
+
fb_suggested_local_service_businesses?: string[];
|
|
266
|
+
fb_suggested_location_based_items?: string[];
|
|
267
|
+
fb_suggested_vehicles?: string[];
|
|
268
|
+
fb_transmission?: string;
|
|
269
|
+
fb_travel_class?: string;
|
|
270
|
+
fb_travel_end?: string;
|
|
271
|
+
fb_travel_start?: string;
|
|
272
|
+
user_bucket?: string;
|
|
273
|
+
value?: number;
|
|
274
|
+
vin?: string;
|
|
275
|
+
year?: number;
|
|
276
|
+
item_number?: string;
|
|
277
|
+
}
|
|
278
|
+
interface OriginalEventDataParameters {
|
|
279
|
+
event_name?: EventName;
|
|
280
|
+
event_time?: number;
|
|
281
|
+
order_id?: number;
|
|
282
|
+
event_id?: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
declare function Purchase$1(): BodyParameters;
|
|
286
|
+
|
|
287
|
+
declare namespace events {
|
|
288
|
+
export { Purchase$1 as Purchase };
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
declare const InitUserData: Settings;
|
|
292
|
+
declare const Purchase: Rule;
|
|
293
|
+
declare const config: {
|
|
294
|
+
order: {
|
|
295
|
+
complete: Rule;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
declare const mapping_InitUserData: typeof InitUserData;
|
|
300
|
+
declare const mapping_Purchase: typeof Purchase;
|
|
301
|
+
declare const mapping_config: typeof config;
|
|
302
|
+
declare namespace mapping {
|
|
303
|
+
export { mapping_InitUserData as InitUserData, mapping_Purchase as Purchase, mapping_config as config };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare const destinationMetaExamples: {
|
|
307
|
+
events: typeof events;
|
|
308
|
+
mapping: typeof mapping;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
export { destinationMetaExamples };
|