Migration from v2 to v3
Prerequisites
- You will need the pixel_id or snap_app_id used in the CAPI v2 events
- You will need the access token - generating a token
Endpoint
The v3 endpoint for web events, using pixel id:
https://tr.snapchat.com/v3/{PIXEL_ID}/events?access_token={TOKEN}
The v3 endpoint for App events, using snap_app_id:
https://tr.snapchat.com/v3/{SNAP_APP_ID}/events?access_token={TOKEN}
Request
The request structure and parameters are different for v3. Please review the changes below to validate all parameters are migrated properly.
Structure of JSON Body
Send all event data in the Body of the request, as a JSON string. The main request body contains a data array which can contain an app_data, user_data, and custom_data object for each event.
The root data array contains 1 or multiple events, with their corresponding data.
The server_parameters are used at the root level of each event, including event_name
The user_data object contains all user related data (i.e em for email, ph for phone, etc.)
The app_data object contains all the app specific data, used for APP events only.
The custom_data object contains other event data like content_ids
and order_id
To read more about how to structure your request view the How to Use the API page
Example
{
"data": [
{
"event_name": "PURCHASE",
"event_time": 1705508777,
..
"user_data" : {},
"custom_data": {},
"app_data": {}
}
]
}
v2 request example
{
"pixel_id": "67d34640-b7a4-42a8-b821-6434d70f08a4",
"timestamp": "1642815764",
"event_conversion_type": "WEB",
"event_type": "PURCHASE",
"event_tag": "jackets",
"page_url": "https://www.example.com",
"price": "43",
"hashed_email" : "8c2a47d3bdb8d3096a6479f53eac3b724291db5f1c31611100f675be5537329d",
"transaction_id": 123123123123
}
v3 request example
{
"event_name": "PURCHASE",
"event_time": 1642815764,
"event_source_url": "https://www.example.com",
"event_id": 123123123123,
"action_source": "WEB",
"user_data": {
"em": "8c2a47d3bdb8d3096a6479f53eac3b724291db5f1c31611100f675be5537329d",
},
"contents": [
{
"id": "",
"quantity": "",
"item_price": "43"
}
]
}
Parameters
v3 Parameters do not match identically to v2. The Parameters page has a full list of available parameters and types.
In which object the parameter should be placed
Validation
This endpoint validates if a conversion event is constructed properly:
Web Validate Endpoint
POST https://tr.snapchat.com/v3/{pixel_id}/events/validate
App Validate Endpoint
POST https://tr.snapchat.com/v3/{snap_app_id}/events/validate
Request Check Tool
Once you have your request ready, use the Request Check Tool to validate your CAPI v3 request