Record events from a page
const url = 'https://stitch-collector-dev.magic-blocks.workers.dev/v1/collect';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '[{"event_id":"smoke-1","ts":1772539200000,"name":"page_view","url":"https://makeabeeline.com/rates?gclid=abc","referrer":null,"props":{}}]'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://stitch-collector-dev.magic-blocks.workers.dev/v1/collect \ --header 'Content-Type: application/json' \ --data '[ { "event_id": "smoke-1", "ts": 1772539200000, "name": "page_view", "url": "https://makeabeeline.com/rates?gclid=abc", "referrer": null, "props": {} } ]'What the SDK posts. Answers 204 immediately and does everything else afterwards, so nothing here shows up as latency on the page. Sets or refreshes the first-party _bid cookie on the page’s registrable domain (HttpOnly, 400 days). A malformed body is silently dropped: this is the one endpoint where a loud error would hurt the page more than it would help the integration. A batch longer than 200 events is cut at 200, not refused; the SDK never sends that many. Cross-origin calls are allowed only from registered domains.
Request Body required
Section titled “Request Body required ”object
Unique per event; the write is idempotent on it.
Epoch milliseconds.
page_view, or a custom event name such as goal.
The page URL as the browser saw it, query string included: click ids and UTM parameters are read from it.
Free-form event properties.
object
Two flags. analytics refused: the visit is counted, no touchpoint is created, no credit is earned. advertising refused: nothing about the person goes to an ad platform.
object
Vendor pixel cookies the SDK found on the page (_fbp, _fbc, _ttp, …). Page code sets these; the SDK forwards them.
object
Example
[ { "event_id": "smoke-1", "ts": 1772539200000, "name": "page_view", "url": "https://makeabeeline.com/rates?gclid=abc", "referrer": null, "props": {} }]Responses
Section titled “ Responses ”Accepted. The set-cookie header carries the _bid cookie.
Only the method shown is served.