Track ad clicks.
Click tracking is essential for measuring ad performance in VTEX Ads. This guide explains how to properly send click events when users interact with your advertisements.
Click event rules
- Click events should be sent immediately when a user clicks on an ad.
- Each click is deduplicated within a 1-hour window per user, per device, per ad.
- Click events require both
user_id
andsession_id
for proper attribution. - Click 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 click event
Use the POST
Track ad clicks endpoint to send click events. Check the endpoint documentation for detailed information about all available fields.
Request example:
_10POST https://events.newtail-media.newtail.com.br/v1/beacon/click/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}
Sucessful response example:
A successful response will have HTTP code 202.
_10{_10 "messages": [_10 "click 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]