Tracking & referrals
/api/event
The pixel posts a page_view here automatically on every page load. You can fire your own events from client code via window.UGCBloom.fire("event_name", …), which posts under the custom event type with whatever metadata you supply. checkout_start is also accepted if you post it yourself — the pixel does not send it automatically.
The endpoint accepts text/plain JSON to dodge CORS preflights and always returns 204. Unknown fields are dropped.
/api/eventRecord a referral event
orgstringYour organization id (required).
kindenumpage_view | checkout_start | custom (required).
session_idstringRandom uuid identifying the visitor (required).
codestring?Promo code (e.g. ANNIE50). Used to resolve creator and campaign for attribution.
source_urlstring?Page URL at the time of the event.
metadataobject?Free-form JSON for custom events.
const response = await fetch(
"https://ugcbloom.com/api/event", {
method: "POST",
headers: {
"Content-Type": "text/plain"
},
body: "{\"org\":\"org_your_org_id\",\"kind\":\"custom\",\"session_id\":\"0e8b…\",\"code\":\"ANNIE50\",\"metadata\":{\"step\":\"viewed_pricing\"}}"
}
);
const data = await response.json();