/schemas/v2/media-buy/log-event-request.json
Response Schema: /schemas/v2/media-buy/log-event-response.json
Quick Start
Log a purchase event:Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
event_source_id | string | Yes | Event source configured on the account via sync_event_sources |
events | Event[] | Yes | Events to log (min 1, max 10,000) |
test_event_code | string | No | Test event code for validation without affecting production data |
Event Object
| Field | Type | Required | Description |
|---|---|---|---|
event_id | string | Yes | Unique identifier for deduplication (scoped to event_type + event_source_id). Max 256 chars. |
event_type | EventType | Yes | Standard event type (e.g. purchase, lead, add_to_cart) |
event_time | date-time | Yes | ISO 8601 timestamp when the event occurred |
user_match | UserMatch | No | User identifiers for attribution matching |
custom_data | CustomData | No | Event-specific data (value, currency, items) |
action_source | ActionSource | No | Where the event occurred (website, app, in_store, etc.) |
event_source_url | uri | No | URL where the event occurred (required when action_source is website) |
custom_event_name | string | No | Name for custom events (used when event_type is custom) |
User Match Object
At least one ofuids, hashed_email, hashed_phone, click_id, or client_ip + client_user_agent is required:
| Field | Type | Description |
|---|---|---|
uids | UID[] | Universal ID values (rampid, id5, uid2, euid, pairid, maid) |
hashed_email | string | SHA-256 hash of lowercase, trimmed email address (64-char hex) |
hashed_phone | string | SHA-256 hash of E.164-formatted phone number (64-char hex) |
click_id | string | Platform click identifier (fbclid, gclid, ttclid, etc.) |
click_id_type | string | Type of click identifier |
client_ip | string | Client IP address for probabilistic matching |
client_user_agent | string | Client user agent string for probabilistic matching |
+12065551234).
Custom Data Object
| Field | Type | Description |
|---|---|---|
value | number | Monetary value of the event |
currency | string | ISO 4217 currency code (e.g. USD, EUR, GBP) |
order_id | string | Unique order or transaction identifier |
content_ids | string[] | Product or content identifiers |
content_type | string | Category of content (product, service, etc.) |
num_items | integer | Number of items in the event |
contents | Content[] | Per-item details (id, quantity, price, brand) |
Response
Success Response:events_received- Number of events receivedevents_processed- Number of events successfully queuedpartial_failures- Events that failed validation (with event_id, code, message)warnings- Non-fatal issues (low match quality, missing fields)match_quality- Overall match quality score (0.0 to 1.0)
errors- Array of operation-level errors (invalid event source, auth failure)
Common Scenarios
Batch Events
Send multiple events in a single request:Test Events
Validate event integration without affecting production data:In-Store Conversions
Report offline conversions using CRM data:Event Deduplication
Events are deduplicated by the combination ofevent_id + event_type + event_source_id. Sending the same event multiple times is safe - duplicates are silently ignored.
Choose event_id values that are stable across retries:
- Transaction IDs:
"order_98765" - Composite keys:
"purchase_user123_20260115" - UUIDs:
"550e8400-e29b-41d4-a716-446655440000"
Error Handling
| Error Code | Description | Resolution |
|---|---|---|
EVENT_SOURCE_NOT_FOUND | Event source not configured | Run sync_event_sources first |
INVALID_EVENT_TYPE | Unrecognized or disallowed event type | Check event source’s event_types configuration |
INVALID_EVENT_TIME | Event time too far in the past/future | Use timestamps within the seller’s attribution window |
MISSING_USER_MATCH | No user identifiers provided | Include at least one of: uids, hashed_email, hashed_phone, click_id, or client_ip + client_user_agent |
BATCH_TOO_LARGE | More than 10,000 events | Split into smaller batches |
RATE_LIMIT_EXCEEDED | Too many requests | Wait and retry with exponential backoff |
Best Practices
-
Configure sources first - Always run
sync_event_sourcesbefore sending events. Events sent to unconfigured sources are rejected. - Include user_match - Events without user identifiers cannot be attributed. Provide the strongest identifiers available: hashed email/phone > UIDs > click IDs > IP/UA. Send multiple identifier types when available to maximize match rates.
-
Use test events first - Set
test_event_codeduring integration to validate events appear correctly without affecting production data. - Batch when possible - Send up to 10,000 events per request to reduce API calls. Events within a batch are processed independently.
-
Include value and currency - For purchase events, always include
custom_data.valueandcustom_data.currencyto enable ROAS reporting and optimization. - Stable event IDs - Use deterministic event IDs (order numbers, transaction IDs) rather than random UUIDs. This ensures safe retries without duplicate counting.
- Send events promptly - Log events as close to real-time as possible. Events outside the seller’s attribution window may not be matched.
Next Steps
- sync_event_sources - Configure event sources before logging events
- create_media_buy - Set optimization goals on packages
- get_media_buy_delivery - Monitor conversion metrics in delivery reports