Conversion
Track when an ad leads to a purchase.
Conversion tracking is crucial for measuring ad campaign effectiveness in VTEX Ads. This guide explains how to properly send conversion events when users complete purchases after interacting with your advertisements.
Conversion event rules
- Conversion events should be sent when an order is closed.
- Each conversion requires both
user_idandsession_idfor proper attribution. - Events must include complete order information including items and customer details, as detailed in
POSTTrack conversions. - Prices must be sent per unit. Don't multiply the
priceorpromotional_priceby thequantity. - All customer identifiers (email, phone, etc.) must be hashed for privacy.
🚧 Don't construct event URLs manually. Always use the URL provided from the
POSTGet ads request.This is extremely important to ensure long-term stability of the integration, because the parameters of the event URL may change over time, but the integration itself does not.
Sending a conversion event
Use the POST Track conversions endpoint to send conversion events. Check the endpoint documentation for detailed information about all available fields.
Request example:
_31POST https://events.newtail-media.newtail.com.br/v1/beacon/conversion HTTP/1.1_31accept: application/json_31content-type: application/json_31_31{_31 "channel": "ecommerce",_31 "publisher_id": "xxx",_31 "user_id": "6f92d1e9-00b6-4f8b-9645-faeab321e1cc",_31 "session_id": "5898b8d1-c250-4bb5-931b-8b9d0ee7b499",_31 "order_id": "123",_31 "email_hashed": "xyz",_31 "items": [_31 {_31 "sku": "12221",_31 "seller_id": "1234",_31 "product_id": "4567",_31 "quantity": 1,_31 "price": 2000.00,_31 "promotional_price": 1899.00_31 },_31 {_31 "sku": "12222",_31 "seller_id": null,_31 "product_id": "4568",_31 "quantity": 2,_31 "price": 500.00,_31 "promotional_price": 400.00_31 }_31 ],_31 "created_at": "2023-01-01T09:20:00Z"_31}
Sucessful response example:
A successful response will have HTTP code 202.
_10{_10 "messages": [_10 "conversion will be processed soon"_10 ]_10}
Failed response example:
A failed response will have HTTP code 422. The error message follows the RFC 8927 format.
_47[_47 {_47 "instancePath": "",_47 "keyword": "required",_47 "message": "must have required property 'user_id'",_47 "params": {_47 "missingProperty": "user_id"_47 },_47 "schemaPath": "#/required"_47 },_47 {_47 "instancePath": "",_47 "keyword": "required",_47 "message": "must have required property 'order_id'",_47 "params": {_47 "missingProperty": "order_id"_47 },_47 "schemaPath": "#/required"_47 },_47 {_47 "instancePath": "",_47 "keyword": "required",_47 "message": "must have required property 'publisher_id'",_47 "params": {_47 "missingProperty": "publisher_id"_47 },_47 "schemaPath": "#/required"_47 },_47 {_47 "instancePath": "",_47 "keyword": "required",_47 "message": "must have required property 'items'",_47 "params": {_47 "missingProperty": "items"_47 },_47 "schemaPath": "#/required"_47 },_47 {_47 "instancePath": "",_47 "keyword": "required",_47 "message": "must have required property 'created_at'",_47 "params": {_47 "missingProperty": "created_at"_47 },_47 "schemaPath": "#/required"_47 }_47]