/Documentation

Twitter conversion API tag

Updated Jul 27, 2026

The X (Twitter) Conversion API allows you to send conversion events from your server directly to X Ads API servers. This helps you measure campaign performance, improve attribution, and track conversions even when browser-based tracking is limited.

This guide focuses on how to configure the X (Twitter) Conversion API tag.

Before you begin

To complete this setup, you will need to create a server GTM container and send data from the web to the server GTM container. Here are the configuration guides:

How to set up X (Twitter) Conversion API tag in sGTM

1. Add “X (Twitter) Conversion API tag” to the server GTM container.

In the server GTM container, go to the section “Templates” → next to “Tag Templates”, click “Search Gallery” → search for “X (Twitter) Conversion API” → add the tag to your container.

Add “X (Twitter) Conversion API tag” to the server GTM container.

2. Create a new tag.

In the section “Tags,” click “New” → as tag configuration, select “X (Twitter) Conversion API” tag.

Create a new tag.

3. Configure the tag.

3.1 Pixel ID - this is your Twitter ad account's Universal Website Tag (UWT) ID. 

To find the Pixel ID, log in to X Business ManagerTools section of the menu → Events Manager → copy Pixel ID.

Configure the tag.

3.2 Event ID - you can find it when creating a conversion API event in the Twitter events manager.

Event ID - you can find it when creating a conversion API event in the Twitter events manager.

The Event ID can be found next to each event you create.

Event ID - you can find it when creating a conversion API event in the Twitter events manager.

3.3 Select Auth Method.

The X (Twitter) Conversion API tag by Stape provides two auth methods:

  • Access Token (recommended) – a simple, recommended authentication using an Access Token generated from your X Ads Manager.
  • OAuth – legacy OAuth 1.0a authentication is still supported but will be removed in December 2026. 

Note:

If you are currently using OAuth as an authentication method, be sure to migrate to Access Token before December 2026.

If you opt for the Access Token method, generate the Pixel Access Token

To do it, go to Events Manager → click on Install Pixel → select Manual on Installation Method → click Continue → select Conversion API → click Continue → click Generate access token.

To do it, go to Events Manager → click on Install Pixel → select Manual on Installation Method → click Continue → select Conversion API → click Continue → click Generate access token.

Here is an example of tag configuration with Access Token as auth method:

Here is an example of tag configuration with Access Token as auth method

If you opt for the OAuth method, click on the collapse element below for detailed guidelines:

3.4 Use HttpOnly cookies - this option forbids JavaScript from accessing the cookie if enabled.

3.5 Use Optimistic Scenario - if selected, the tag will call gtmOnSuccess() without waiting for a response from the API. This will speed up sGTM response time; however, your tag will always return the status fired successfully even in case it is not.

3.6 Server Event Data Override - Manually override or add server event data parameters. Available properties: 

  • Conversion Time
  • Number Items
  • Currency
  • Value
  • Conversion ID
  • Description
  • Contents
  • Search String. 

See X’s documentation for more details on what data parameters you can override.

See X’s documentation for more details on what data parameters you can override.

3.7 User Data - add user data: email, phone, click ID, IP address, User Agent.

Note: At least one identifier must always be sent.

Note: At least one identifier must always be sent.

Event deduplication

Twitter supports event deduplication. Combining web and server tracking requires sending a deduplication key with both web and server events. 

Use the Conversion ID (for deduplication) that can be found in the Server Event Data Override to send the deduplication key in the server GTM tag.

Use the Conversion ID (for deduplication) that can be found in the Server Event Data Override to send the deduplication key in the server GTM tag.

Find the corresponding parameter in the web GTM tag or pixel code (Conversion ID, if using the Twitter tag template, or conversion_id if using the pixel code).  Deduplication happens only if events were received within 48 hours.

To create a server-only event, use the Twitter events manager to create a new event and select Install with Conversion API on the third step. 

To create a server-only event, use the Twitter events manager to create a new event and select Install with Conversion API on the third step.

4. Add a trigger for a tag.

Specify the condition when the tag should fire (e.g., add to cart, purchase events).

How to test X (Twitter) CAPI 

Unfortunately, X (Twitter) doesn't provide a real-time event testing tool for Conversion API events.

To verify that your implementation is working:

  • Use the server GTM Preview mode to confirm that the X Conversion API tag fires correctly and that requests are sent to X.
Use the server GTM Preview mode to confirm that the X Conversion API tag fires correctly and that requests are sent to X.
  • If you use Stape Logs, check the outgoing requests to verify that events are successfully sent to the X endpoint in real time.
If you use Stape Logs, check the outgoing requests to verify that events are successfully sent to the X endpoint in real time.
  • In X Ads Manager, go to Conversion Tracking and check the status of your event. Once X starts receiving events, the event status will change to Active. You can also click View activity to see the events received by X.

Keep in mind that it may take 12–24 hours for the event status and activity to appear in X Ads Manager after the first events are sent.

Was this article helpful?

Comments

Can’t find what you are looking for?