@g2crowd/buyer-intent-provider-sdk 0.4.0 → 0.4.1
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/README.md +56 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -309,6 +309,10 @@ export { POST };
|
|
|
309
309
|
|
|
310
310
|
## Event Payload
|
|
311
311
|
|
|
312
|
+
The client sends a beacon to the activity endpoint. The server handler wraps it into a composite event and writes it to Kafka.
|
|
313
|
+
|
|
314
|
+
### Client → Server (sendBeacon body)
|
|
315
|
+
|
|
312
316
|
```json
|
|
313
317
|
{
|
|
314
318
|
"name": "$view",
|
|
@@ -320,15 +324,64 @@ export { POST };
|
|
|
320
324
|
"user_type": "standard",
|
|
321
325
|
"distinct_id": "visitor-uuid",
|
|
322
326
|
"origin": "yoursite.com",
|
|
323
|
-
"source_location": "ProductsController#show"
|
|
327
|
+
"source_location": "ProductsController#show",
|
|
328
|
+
"context": {}
|
|
324
329
|
},
|
|
325
330
|
"visit": {
|
|
326
331
|
"properties": {
|
|
327
332
|
"landing_page": "https://yoursite.com/products/acme-crm",
|
|
328
333
|
"referrer": "https://google.com/",
|
|
329
|
-
"user_agent": "Mozilla/5.0",
|
|
330
|
-
"utm_source": "newsletter"
|
|
334
|
+
"user_agent": "Mozilla/5.0 ...",
|
|
335
|
+
"utm_source": "newsletter",
|
|
336
|
+
"utm_medium": "email",
|
|
337
|
+
"utm_campaign": "spring-2026",
|
|
338
|
+
"utm_term": "crm+software",
|
|
339
|
+
"utm_content": "hero-cta"
|
|
331
340
|
}
|
|
332
341
|
}
|
|
333
342
|
}
|
|
334
343
|
```
|
|
344
|
+
|
|
345
|
+
### Server → Kafka (composite event)
|
|
346
|
+
|
|
347
|
+
The server enriches the client payload with server-side tokens, timestamps, and IP before writing to Kafka. This is the shape written to the `intent_events_{partnerId}` topic:
|
|
348
|
+
|
|
349
|
+
```json
|
|
350
|
+
{
|
|
351
|
+
"event": {
|
|
352
|
+
"id": "e0c1f2a3-...",
|
|
353
|
+
"name": "$view",
|
|
354
|
+
"time": "2026-02-17T14:20:00.000Z",
|
|
355
|
+
"properties": {
|
|
356
|
+
"product_ids": [123],
|
|
357
|
+
"category_ids": [45],
|
|
358
|
+
"tag": "products.show",
|
|
359
|
+
"url": "https://yoursite.com/products/acme-crm",
|
|
360
|
+
"user_type": "standard",
|
|
361
|
+
"distinct_id": "visitor-uuid",
|
|
362
|
+
"origin": "yoursite.com",
|
|
363
|
+
"source_location": "ProductsController#show",
|
|
364
|
+
"context": {}
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
"visit": {
|
|
368
|
+
"visit_token": "a1b2c3d4-...",
|
|
369
|
+
"visitor_token": "f5e6d7c8-...",
|
|
370
|
+
"started_at": "2026-02-17T14:20:00.000Z",
|
|
371
|
+
"created_at": "2026-02-17T14:20:00.000Z",
|
|
372
|
+
"properties": {
|
|
373
|
+
"landing_page": "https://yoursite.com/products/acme-crm",
|
|
374
|
+
"referrer": "https://google.com/",
|
|
375
|
+
"user_agent": "Mozilla/5.0 ...",
|
|
376
|
+
"ip": "203.0.113.42",
|
|
377
|
+
"utm_source": "newsletter",
|
|
378
|
+
"utm_medium": "email",
|
|
379
|
+
"utm_campaign": "spring-2026",
|
|
380
|
+
"utm_term": "crm+software",
|
|
381
|
+
"utm_content": "hero-cta"
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
The server sets `visit_token` and `visitor_token` as `httpOnly` cookies so repeat visits from the same browser share stable tokens.
|