conversion_id
) to deduplicate events between Pixel and Conversion API for the same event. See section d. Testing Events and Deduplication for more information.
twclid
), email address, or phone number. If using IP address or user agent, a second identifier must be sent for proper conversion matching.
Passing more identifiers will yield a higher conversion matching rate.
Customer matching field | Format | Hashing required? |
X Click ID | X generated (learn more) | No |
Email Address | Remove leading and trailing spaces | Required (SHA256) |
Phone Number | E164 Standard | Required (SHA256) |
IP Address | Remove leading and trailing spaces | No |
User Agent | Remove leading and trailing spaces | No |
POST: version/measurement/conversions/:pixel_id
Send conversion events for a particular ad account. The response code should be checked for success (HTTP 200 OK). It is recommended to have a retry mechanism and basic logging in place in case of error codes are returned.
For detailed information about the endpoint’s URL and POST body parameters, please see the API Reference section.
How does the conversion tracking tag work?
Is there a way within the campaign setup process that allows the user to select which tracking pixels are relevant for that campaign?
What are our default attribution window settings for conversion tags?
What are some ideas for effective DR creatives and strategies that will effectively drive conversions?
Reason | Type | Error Message |
---|---|---|
Missing Identifier Error (currently hashed email or X click ID - twclid) | 400 Bad Request | At least one user identifier must be provided |
Invalid hashed email | 400 Bad Request | Hashed_email is not a valid SHA-256 hash |
The type of event_id is not a single event tag (SET) | 400 Bad Request | Event_id (<event_id>) is not a single event tag (SET) |
Requested conversion events exceed the limit (currently 500 events per request) | 400 Bad Request | Conversion count limit is 500 |
Missing Event ID | 400 Bad Request | Event ID was not found |
POST '/11/measurement/conversions/o6dkt' --data '{"conversions":[{"conversion_time": "2022-06-16T01:14:00.603Z", "event_id":"o6dkt", "identifiers": [{"twclid": "23opevjt88psuo13lu8d020qkn"}]}]}' --header 'Content-Type: application/json
{"errors":[{"code":"INVALID_PARAMETER","message":"event_id (o6dkt) is not a single event tag (SET)","parameter":"event_id"}],"request":{"params":{"account_id":"18ce552mlaq"}}}
twurl_ads -X POST '/11/measurement/conversions/o6dkt' --data '{"conversions":[{"conversion_time": "2022-06-16T01:14:00.603Z", "event_id":"o6dl3", "identifiers": [{"twclid": ""}]}]}' --header 'Content-Type: application/json'
{"errors":[{"code":"INVALID_PARAMETER","message":"At least one user identifier must be provided","parameter":""}],"request":{"params":{"account_id":"18ce552mlaq"}}}
twurl_ads -X POST '/11/measurement/conversions/o6dkt' --data '{"conversions":[{"conversion_time": "2022-06-16T01:14:00.603Z", "event_id":"o6dl3", "identifiers": [{"hashed_email": "abc"}]}]}' --header 'Content-Type: application/json'
{"errors":[{"code":"INVALID_PARAMETER","message":"hashed_email (abc) is not a valid SHA-256 hash","parameter":"hashed_email"}],"request":{"params":{"account_id":"18ce552mlaq"}}}
twurl_ads -X POST '/11/measurement/conversions/o6dkt' --data '{"conversions":[{"conversion_time": "2022-06-16T01:14:00.603", "event_id":"o6dl3", "identifiers": [{"twclid": "23opevjt88psuo13lu8d020qkn"}]}]}' --header 'Content-Type: application/json'
{"errors":[{"code":"INVALID_PARAMETER","message":"Expected Time in yyyy-MM-ddTHH:mm:ss.SSSZ, got \"2022-06-16T01:14:00.603\" for conversion_time","parameter":"conversion_time"}],"request":{"params":{"account_id":"18ce552mlaq"}}}
Reason | Type | Error Message |
---|---|---|
The developer account you’re using does not have Ads API Access. Apply for access here. | 403 Unauthorized Client | The client application with id <> making this request does not have access to X Ads API. Ensure your application has advertiser-api access. Use ‘twurl accounts’ and ‘twurl set default <username> <key>’ to change the application you’re using. |
Reason | Type | Error Message |
---|---|---|
The request URL or params is not correct for the endpoint | 404 Route Not Found | The requested resource could not be found |
You do not have access to the account that owns the pixel_id/Universal website tag | 404 Not Found | User <user_id> does not have access to account <account_id>. Type ‘sn <user_id>’ to get the handle of the user. Use ‘twurl accounts’ and ‘twurl set default \u003Cusername\u003E’ to change the user you’re using. |
The event id does not belong to the provided account associated with the pixel ID (UWT ID) | 404 Not Found | event_id <event_id> does not belong to provided account |
twurl_ads -X POST '/11/measurement/conversions/o8z6j' --data '{"conversions":[{"conversion_time": "2022-06-16T01:14:00.603Z", "event_id":"abc", "identifiers": [{"twclid": "23opevjt88psuo13lu8d020qkn"}]}]}' --header 'Content-Type: application/json'
Error message:
{"errors":[{"code":"NOT_FOUND","message":"event_id (abc) does not belong to provided account","parameter":"event_id"},{"code":"INVALID_PARAMETER","message":"event_id (abc) is not a single event tag (SET)","parameter":"event_id"}],"request":{"params":{"account_id":"18ce55gze09"}}}
Conversion API | measurement/conversions/:pixel_id |
Web Event Tag | accounts/:account_id/web_event_tags |
POST version/measurement/conversions/:pixel_id
Send website conversion events for a single Event Tag ID.
The response code should be checked for success (HTTP 200 OK). It is recommended to have a retry mechanism and basic logging in place in case error codes are returned.
The rate limit will be 100,000 request per 15 minute interval per account (each request allows 500 events).
https://ads-api.x.com/12/measurement/conversions/:pixel_id
Name | Description |
---|---|
pixel_id required | The Base Tag ID for an ad account. This represents that base36 encoded value for an ad account’s Base Tag ID. Type: string Example: o8z6j |
conversions required | The object in POST body of the API request. List of conversion events. Up to 500 conversion events may be provided. See the table below for supported fields. Type: array Example: "conversions":[{"conversion_time": "2022-02-18T01:14:00.603Z", "event_id":"o87ne", "identifiers": [{"twclid": "23opevjt88psuo13lu8d020qkn"}], "conversion_id": "23294827"}] |
Name | Description |
---|---|
conversion_time required | The time, expressed in ISO 8601. Type: string Example: 2017-10-05T00:00:00Z |
event_id required | The base-36 ID of a specific event. It matches a pre-configured event contained within this ad account. This is called ID in the corresponding event in Events Manager. Type: string Example: o87ne or tw-o8z6j-o87ne (tw-pixel_id-event-id ) both accepted |
identifiers required | A list of identifier objects to match the conversion event to. Supported fields are listed in a table below. At least one of the identifier objects is required. If using IP address or user agent, a second identifier must be sent for proper conversion matching. Type: array Example: "identifiers": [{"twclid": "23opevjt88psuo13lu8d020qkn"},{"hashed_email": "e586883b2b4faf78d48300a79e0e15138d664cdf796ffb86e533170a9893eda8"}] |
number_items optional | The number of items being purchased in the event. Must be a positive number greater than zero. Type: integer Example: 4 |
price_currency optional | The currency of items being purchased in the event, expressed in ISO-4217. See Currency for detailed information. Type: string Default: USD Example: JPY |
value optional | The price value of items being purchased in the event, represented in price_currency currency.Type: double Example: 100.00 |
conversion_id optional | For deduplication between pixel and conversion API conversions. An identifier for a conversion event that can be used for de-duplication between Web Pixel and Conversion API conversions in the same event tag. See the Conversions Guide’s Testing Events and Deduplication section for more information. Type: string Example: 23294827 |
description optional | Description with any additional information on the conversions. Type: string Example: test conversion |
contents optional | List of details relating to a specific product/content to provide granular information. See table below for supported fields. Type: array Example: contents": [{"content_id": "1", "content_name": "Blankets", "content_type": "home improvement", "content_price": 100.99, "num_items": 1, "content_group_id": "123"}, {"content_id": "2"}] |
Name | Description |
---|---|
twclid sometimes required | Click ID as parsed from the click-through URL. It’s required if no other identifier is added. Type: string Example: 26l6412g5p4iyj65a2oic2ayg2 |
hashed_email sometimes required | An email address hashed with SHA256. The text must be lowercase, remove any trailing or leading spaces before hashing. It’s required if no other identifier is added. Type: string Example: For test-email@test.com = e586883b2b4faf78d48300a79e0e15138d664cdf796ffb86e533170a9893eda8 |
hashed_phone_number sometimes required | A phone number with E164 format and hashed with SHA256. The phone number must be in E164 format before hashing. It’s required if no other identifier is added. Type: string Example: For +11234567890 = 1fa6b8d986d9b9cd01bf36951815158bbde9f520c0567c835dfe34783d0a4231 |
ip_address sometimes required | This value is written in dotted-decimal notation, with four numbers separated by periods. IP address is required to be passed in conjunction with another identifier (twclid, email address, phone number or user agent). Type: string Example: 8.25.197.25 |
**user_agent ** sometimes required | This identifier allows the server to identify the application, operating system, vendor, and/or version of the requesting user agent. User Agent is required to be passed in conjunction with another identifier (twclid, email address, phone number or IP address). Type: string Example: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36. |
Name | Description |
---|---|
content_id optional | SKU or GTIN; identifier that represents the content. Type: string Example: jhp |
content_group_id optional | ID associated with a group of product variants Type: integer Example: group 1 |
content_name optional | Name of the product or service. Type: string Example: radio flyer |
content_price optional | Price of the product or service. Type: double Example: 5.00 |
content_type optional | Category for the product that was purchased. Type: string Example: clothes |
num_items optional | Number of products purchased Type: integer Example: 1 |
Name | Description |
---|---|
conversions_processed | Number of conversions successfully processed Type: integer Example: 1 |
debug_id | A debug UUID that can be used for subsequent investigations Type: string Example: ff02e052-36e4-47d6-bdf0-6d8986446562 |
GET accounts/:account_id/web_event_tags
Retrieve details for some or all web event tags associated with the current account.
https://ads-api.x.com/12/accounts/:account_id/web_event_tags
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 200 Min, Max: 1 , 1000 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: 8x7v00oow |
sort_by optional | Sorts by supported attribute in ascending or descending order. See Sorting for more information. Type: string Example: created_at-asc |
web_event_tag_ids optional | Scope the response to just the desired web event tags by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example: o3bk1 |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
with_total_count optional | Include the total_count response attribute.Note: This parameter and cursor are exclusive.Note: Requests which include total_count will have lower rate limits, currently set at 200 per 15 minutes.Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/web_event_tags?web_event_tag_ids=o3bk1
https://ads-api.x.com/12/accounts/:account_id/web_event_tags/:web_event_tag_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
web_event_tag_id required | A reference to the web event tag you are operating with in the request. Type: string Example: o3bk1 |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/web_event_tags/o3bk1
https://ads-api.x.com/12/accounts/:account_id/web_event_tags
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
click_window required | The click window for this web tag. Note: Only the possible values listed below are accepted. Type: int Possible values: 1 , 7 , 14 , 30 |
name required | The name of the web tag. Type: string Example: Sample single conversion event |
retargeting_enabled required | Indicates if retargeting should be enabled for this web tag. Type: boolean Possible values: true , false |
type required | The type of web tag. Type: enum Possible values: ADDED_PAYMENT_INFO , ADD_TO_CART , ADD_TO_WISHLIST , CHECKOUT_INITIATED , CONTENT_VIEW , CUSTOM , DOWNLOAD , PRODUCT_CUSTOMIZATION ,PURCHASE , SEARCH , SIGN_UP , SITE_VISIT , START_TRIAL , SUBSCRIBE (On UI, SITE_VISIT is shown as “Page view” and SIGN_UP is shown as “Lead”) |
view_through_window required | The view through window for this web tag. This value must always be less than or equal to the click_window value.Note: Only the possible values listed below are accepted. Type: int Possible values: 0 , 1 , 7 , 14 , 30 |
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/web_event_tags?click_window=7&name=web event tag&retargeting_enabled=false&type=SITE_VISIT&view_through_window=7
https://ads-api.x.com/12/accounts/:account_id/web_event_tags/:web_event_tag_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
web_event_tag_id required | The identifier for a web tag on the current account. Type: string Example: o3bk1 |
click_window optional | The click window for this web tag. Note: Only the possible values listed below are accepted. Type: int Possible values: 1 , 7 , 14 , 30 |
name optional | The name of the web tag. Type: string Example: Sample single conversion event |
retargeting_enabled optional | Indicates if retargeting should be enabled for this web tag. Type: boolean Possible values: true , false |
type optional | The type of web tag. Type: enum Possible values: Possible values: ADDED_PAYMENT_INFO , ADD_TO_CART , ADD_TO_WISHLIST , CHECKOUT_INITIATED , CONTENT_VIEW , CUSTOM , DOWNLOAD , PRODUCT_CUSTOMIZATION ,PURCHASE , SEARCH , SIGN_UP , SITE_VISIT , START_TRIAL , SUBSCRIBE (On UI, SITE_VISIT is shown as “Page view” and SIGN_UP is shown as “Lead”) |
view_through_window optional | The view through window for this web tag. This value must always be less than or equal to the click_window value.Note: Only the possible values listed below are accepted. Type: int Possible values: 0 , 1 , 7 , 14 , 30 |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/web_event_tags/o3bk1?type=DOWNLOAD
https://ads-api.x.com/12/accounts/:account_id/web_event_tags/:web_event_tag_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
web_event_tag_id required | The identifier for a web tag on the current account. Type: string Example: o3bk1 |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/web_event_tags/o3bk1