Skip to content

Record events from a page

POST
/v1/collect
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.

Media type application/json
Array<object>
<= 200 items
object
event_id
required

Unique per event; the write is idempotent on it.

string
ts
required

Epoch milliseconds.

integer format: int64
name
required

page_view, or a custom event name such as goal.

string
url
required

The page URL as the browser saw it, query string included: click ids and UTM parameters are read from it.

string format: uri
page_title
string | null
referrer
string | null format: uri
props

Free-form event properties.

object
key
additional properties
any
consent

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
analytics
boolean
advertising
boolean
platform_ids

Vendor pixel cookies the SDK found on the page (_fbp, _fbc, _ttp, …). Page code sets these; the SDK forwards them.

object
key
additional properties
string
Example
[
{
"event_id": "smoke-1",
"ts": 1772539200000,
"name": "page_view",
"url": "https://makeabeeline.com/rates?gclid=abc",
"referrer": null,
"props": {}
}
]

Accepted. The set-cookie header carries the _bid cookie.

Only the method shown is served.