Conversion tracking enables you to measure your return on ad spend by tracking the actions people take after viewing or engaging with your ads on . Your conversion events will allow you to report on the performance of your campaigns but can also be used to help better optimize and target your ads.
There are two solutions to choose from:
Both solutions achieve the same goal and have largely the same functionality: enabling conversion tracking for your web campaigns. It is critical to implement at least one of these options in order to unlock the full capabilities of web campaigns.
The Pixel is made up of two parts:
Implementation: You have two options to implement the Pixel - via direct integration or via a supported 3rd party Tag Manager.
Setting up the Pixel requires:
1. Log into your ads account at ads.x.com
2. Under “Tools,” select “Events Manager”
3. Click on “Add event source” and read/select “I agree” to the terms of use
4. You will now see that your Base Pixel has been generated alongside the auto-created event types for “Landing Page Views” and “Site Visits.”
5. Next, you’ll need to create events to track actions across your website. Which actions to track may vary, depending on your goals. For example: an e-commerce company may want to implement “Add-to-Cart” and “Purchase” events while an advertiser tracking email sign-ups may want to implement “Lead.”
6. Click the “Add events” button.
7. On the “Event Details” screen, enter a name for the event. From the Type dropdown, choose the type of action you would like to track. You can also adjust your attribution window and toggle on “Website activity audience” if you so choose. Click “Create Event.”
8. In the “Event installation” screen, you can see three tabs at the top, which allow you to access the instructions for your preferred installation approach. More details on the Tag Manager installation are provided here and more details on Conversion API can be found here.
When choosing to install the pixel code in your website code, you’ll be able to use the checkboxes to create a template of your event code pixel. Select the event parameters that you wish to use and the template pixel code will dynamically change below. Hit “Done” to save your newly created event.
the parameter check boxes only serve to create a template of your event code. Checking the boxes will not automatically measure these event parameters. The code will need to be updated to dynamically pass values for the event parameters. More detail is provided in the implementation details below.
9. Repeat steps 6 to 8 to create events for all the relevant actions you would like to track.
After completing the above, you will need to implement your newly created pixel base code and event code in order to start tracking actions.
You can choose to implement the Pixel base code and event code either by:
This section walks through direct implementation. If you plan to integrate your base code and/or event code via a Tag Manager, check out the Tag Manager section here.
1. In “Events Manager,” near the top of the page, click on “View Twitter pixel” for the pixel you would like to implement.
2. From the “Website code” page, copy or download the pixel code in the “Pixel code” field.
3. Paste this code before the </head> HTML tag of all pages on your website. (Implementing across your website is critical to properly track actions across your website.)
1. In “Events Manager,” find the event you would like to implement.
2. Click on the “View install code” button on the right corner of each event name.
3. Click on the “Copy Code” or “Download” button.
4. Add this code to specific elements of your website (like a thank you page or “download” button).
5. Repeat steps 1-4 for each event you would like to track.
If you are using more than one ads account for marketing your website, you may end up needing to add multiple base codes and event codes to the same page. For example, you have two accounts with pixel_id1 and pixel_id2 respectively, and you want to track an event for each account on a page with event id tw-pixel_id1-event_id1 and tw-pixel_id2-event_id2, respectively.
You can bundle the pixel code together as follows:
<!-- Twitter conversion tracking base and event code -->
<script>
!function(e,t,n,s,u,a)
{e.twq||(s=e.twq=function()
{s.exe?s.exe.apply(s,arguments):s.queue.push(arguments); },
s.version='1.1',s.queue=[],u=t.createElement(n),
u.async=!0,
u.src='https://static.ads-twitter.com/uwt.js',
a=t.getElementsByTagName(n)[0],
a.parentNode.insertBefore(u,a))}
(window,document,'script');
twq('config','pixel_id1');
twq('config','pixel_id2');
twq('event', 'event_id1');
// tw-o6ou1-o9l96 twq('event', 'event_id2');
// tw-o6ou1-o7uw7
</script>
<!-- End Twitter conversion tracking base and event code →For help with how to select conversion events during the campaign creation process, please see our guidelines on setting up website traffic campaigns and sales campaigns.
Conversion events help you track the actions important to you and your business. With each event, you can select the type you want to track and choose to pass back certain parameters to share more about the action.
You can choose from a range of available options when setting up a conversion event.
Page view, Add to cart, Lead, Added payment info, Purchase, Custom
(Note: If you have any legacy event types active in your Event manager, it is possible to optimize towards them when setting up Web objective campaigns. But if there are not any corresponding metrics when viewing campaign results, please remove and re-create the event using the new event types available instead.)
Contents, Conversion ID, Email address, Value, Currency
If you choose to implement both the Pixel and Conversion API, we strongly recommend using our deduplication key parameter. To do so, you can use the “conversion_id” event parameter. This parameter can be included in Pixel or Conversion API requests. For example, for a Purchase event, the event code could look like this:
twq('event', 'tw-pixel_id1-event_id1', {
value: 200.00,
currency: 'USD',
conversion_id: ‘1234abcd’,
contents:
[
{content_id: 'OT001', content_name: ‘bird seed’, content_price: 50, num_items: 1},
{content_id: 'OT002', content_name: ‘bird cage, content_price: 150, num_items: 1}
]
});
</script>Event parameters give details into the conversion action - e.g. what the product was. Certain parameters can also be used to improve measurement.
Parameters, with the right events, can even be used to gain an understanding of the ROI of your website campaigns, including the total revenue or total conversion value your campaign generated, and the total number of items purchased.
To record how much someone is spending or the amount they’re buying, you need to install the proper event (like Purchase) and pass values to event parameters in your event code.
This table provides an overview of all available parameters you can use for your events. Note, these event parameters can only be used for events defined with code and not for events using URL rules.
| Parameter | Description | Data type |
|---|---|---|
value | Total value of the conversion event (ex: $ value of the transaction in case of a purchase, etc.) | Integer or float |
currency | ISO 4217 code (e.g. USD, JPY, EUR) | String |
conversion_id | Unique identifier for the event that can be used for deduplication purposes | String |
search_string | Text that was searched for on your website | String |
description | A string description for additional info | String |
twclid | click ID that can be included with any request. The Pixel already automatically passes twclid from URL or first-party cookie. This parameter can be optionally used to force attribution to a certain ad click. | String |
status | Status of the sign up or subscription, could be “started” or “completed” | String |
contents | Array of JSON Objects representing multiple products/content. See below for sub-parameters that can be included in the array. | Array of Objects |
| Sub-parameter | Description | Data type |
|---|---|---|
content_type | Category of the product purchased (Google product taxonomy) | String |
content_id | For product catalog users: please pass SKU For all other users: Please pass Global Trade Item Number (GTIN) if available, otherwise pass SKU | String |
content_name | Name of a product or service | String |
content_price | Price of a product or service | Integer or float |
num_items | Number of products purchased | Integer |
content_group_id | ID associated with a group of product variants | String |
An example code snippet for a Purchase event could look like this:
<!-- Twitter conversion tracking base and event code -->
<script>
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='https://static.ads-twitter.com/uwt.js',
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
twq('config',pixel_id1');
twq('event', 'tw-pixel_id1-event_id1', {
value: 200.00,
currency: 'USD',
contents:
[
{content_id: 'OT001', content_name: ‘bird seed’, content_price: ‘50’, num_items: ‘1’},
{content_id: 'OT002', content_name: ‘bird cage, content_price: ‘150’, num_items: ‘1’}
]
});
</script>
<!-- End Twitter conversion tracking base and event code →We also support user parameters, that allow you to pass additional hashed data to improve measurement coverage. Currently, we offer the ability to pass back email addresses and phone numbers, either via the Pixel or Conversions API.
An example code snippet for a Purchase event with user data could look like this:
<!-- Twitter conversion tracking base and event code -->
<script>
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='https://static.ads-twitter.com/uwt.js',
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
twq('config',pixel_id1');
twq('event', 'tw-pixel_id1-event_id1', {
email_address: '[email protected]',
phone_number: '+11234567890',
value: 200.00,
currency: 'USD',
contents:
[
{content_id: 'OT001', content_name: ‘bird seed’, content_price: ‘50’, num_items: ‘1’},
{content_id: 'OT002', content_name: ‘bird cage, content_price: ‘150’, num_items: ‘1’}
]
});
</script>
<!-- End Twitter conversion tracking base and event code →Website Activity Audiences from the Pixel enable you to reach people on who recently expressed interest in your products by visiting your website. Website Activity Audiences uses the same Pixel for conversion tracking from this page. Learn more about Website Activity Audiences.
Restricted Data Use (RDU) parameter enables an advertiser to limit ’s use of certain data for specific business purposes only on that advertiser’s behalf.
Advertisers decide for themselves when and how to leverage RDU—for example, an advertiser may want to apply the RDU parameter on a per-user basis based on an opt-out signal, or more broadly based on user location in regions where certain laws apply.
To learn more about how to set up RDU, please visit the Ads Help portal and file a ticket under Mobile App, Conversion Tracking & Audience Manager >> How to set up Restricted Data Use.
Once you’ve placed the Pixel, return to the "Events Manager" tab in Ads to verify its status. For events defined with code, you will see the status in the main dashboard of Events Manager. For the base code, you may check the tracking status of the “auto-created” events - Site Visit or Landing Page View.
There are 3 different status types for website conversion events:
Once your pixel has been implemented and it starts sending events to you can use the Recent Activity Log to look at recent data being received and verify if the events and parameters are being sent correctly. To do so:
You can use this tool to quickly check if the events and parameters you implemented in your pixel are sending accurate and valid data.
Your pixel begins sending data to the Ads UI the first time someone visits your tagged web page. If you're experiencing problems with your pixel or just want to be thorough, please complete the following steps to explore the code from your site and verify that your website tag is placed and working properly.
If you notice any issues with an implemented pixel, we also recommend leveraging the Pixel Helper, a Google Chrome extension. The Pixel Helper shares the tracking status of the Pixel and relevant events and includes error codes depending on what the issue may be.
Learn more about the Pixel Helper here and download the extension here.
We have added a 302 redirect rule for our Online Conversion Tracking Tag (oct.js) and Universal Conversion Tracking tag (uwt.js). The redirect works as follows:
https://platform.twitter.com/oct.js ==> https://static.ads-twitter.com/oct.js
https://platform.twitter.com/uwt.js ==> https://static.ads-twitter.com/uwt.js
related to Click ID, if you are using a "Content-Security-Policy" (CSP) header on your website, ensure that you're allowlisting "ads-twitter.com", "ads-api.twitter.com", and "analytics.twitter.com" in "img-src" and "connect-src" directives in order to continue to see results with the Pixel.
Please note: third-party interfaces may not reflect the capabilities of our website tracking in Ads Manager, and they may only pertain to information collected by that third-party.
1. Log into your ads account at ads.x.com
2. Under “Tools,” select “Events Manager”
3. Click on “Install Pixel” and select “Partner Integrations” and “Google Tag Manager” as your implementation method
4. Click “continue” to connect with Google Tag Manager, you will be prompted to authorize access to your Google account
5. Once your account is connected, select the Google Tag Manager container that will be used to deploy your Pixels
6. Review the account information and custom HTML before publishing your changes
7. Validate that your pixels are correctly implemented by navigating to your Google Tag Manager account
8. Repeat steps 5 - 7 if you are also deploying server-side (Conversion API) events
The ‘ Conversion Tracking (UWT)’ app will be deprecated. Instead, please use the Pixel template.
Only create a Base Pixel once
Make sure that you create a base pixel before creating event pixels
The logic for the Base Pixel template and the Event Pixel template logic have been combined within Tealium iQ Event Triggers and Data Mappings for easier-to-use tagging.
Create an Event Pixel trigger:
*The relationship is now created so that when page_name equals confirmation, the Event Pixel will be invoked and map the order_id parameter when that event occurs. The connection is made with the Event ID being inputted in both the Event Code ID fields within the Events and Event-specific Parameters sections.
10. Select the green +Add button to add the Event Code ID mapping.
11. Once your Base Pixel and Event triggers are completed. Click the Apply button to complete your initial configuration. The profile will need a save/publish completed prior to testing your tag. Please follow your standard tag testing and publishing workflow.
Conversion API (CAPI) is a measurement solution that allows a direct, server-to-server connection to share conversion data with to enable the measurement of campaigns.
Conversion API increases measurement options and provides you with control over what data is shared. This is a complementary measurement solution to the Pixel and can be used with or without the pixel.
Multiple data signals with Conversion API can be used (including Click ID, email address, phone number, IP address, or user agent) to send conversion events to the API endpoint.
Using the Conversion API also allows you to track offline conversion events. Conversion events can often start online, but finish offline. Using an offline Conversion API solution means you can measure these conversions in addition to your online conversions.
Implementation: Setting up the Conversion API requires access to the Ads API and an active Developer Account. More details and a step-by-step guide can be found on our Conversion API documentation setup page.
In addition to our Conversion API guide that you can use to get started on your own, you can leverage a third-party partner to help you integrate with our Conversion API product. We currently partner with Adobe, Tealium, Metarouter, Datahash, and Rudderstack. If you already work with one of those partners you can follow the links above to their documentation to learn how to integrate with 's solution. If you are interested in working with one of these partners on setting up a Conversion API integration, please consider reaching out to them to confirm availability.
If the pixel didn’t load, the following solutions may correct this:
On a page that tracks both page landings and button clicks, try to implement the pixel on the buttons separate from the tag that's tracking page lands.
For buttons, open a new page. If the implementation looks correct, the webpage may be unloading before the tag can finish loading. Allow the tag to continue loading while the new page is being loaded, or open a new tab instead so that the tag can continue loading in the existing tab.