Track views for banner ads.
VTEX Ads uses view tracking to measure when banner advertisements are effectively displayed to users. This guide explains how to properly send view events when banner ads become visible to users.
View event rules
- View events should only be sent for banner ads.
- View events require both
user_id
andsession_id
for proper attribution. - View URLs are unique to each ad and should be obtained from the Get ads response.
🚧 Don't construct event URLs manually. Always use the URL provided from the
POST
Get 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 view event
Use the POST
Track ad views endpoint to send view events. Check the endpoint documentation for detailed information about all available fields.
Request example:
_10POST https://events.newtail-media.newtail.com.br/v1/beacon/view/4a94bc6e-7db1-425f-8430-cb4d17488b3b?pos=1 HTTP/1.1_10accept: application/json_10content-type: application/json_10_10{_10 "user_id": "6f92d1e9-00b6-4f8b-9645-faeab321e1cc",_10 "session_id": "5898b8d1-c250-4bb5-931b-8b9d0ee7b499"_10}
Successful response example:
A successful response will have HTTP code 202.
_10{_10 "messages": [_10 "view 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.
_23[_23 {_23 "instancePath": "",_23 "keyword": "required",_23 "message": "must have required property 'user_id'",_23 "params": { "missingProperty": "user_id" },_23 "schemaPath": "#/anyOf/0/required"_23 },_23 {_23 "instancePath": "",_23 "keyword": "required",_23 "message": "must have required property 'session_id'",_23 "params": { "missingProperty": "session_id" },_23 "schemaPath": "#/anyOf/1/required"_23 },_23 {_23 "instancePath": "",_23 "keyword": "anyOf",_23 "message": "must match a schema in anyOf",_23 "params": {},_23 "schemaPath": "#/anyOf"_23 }_23]