Conversion tracking for websites

 

Overview

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 X. 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.

New! We have rolled out a series of improvements across our Conversion Tracking products, designed to help expand on our existing solutions, improve setup, and increase measurement flexibility. These include:

  • The new X Pixel

  • Conversion API 

  • New Conversion Tracking Set Up Page

  • Expanding Click ID Lower Funnel functionality

  • New Event Types and Parameters

  • Better defining our Website Traffic Event types

  • New Deduplication Logic

  • Revamped Pixel Helper

  • Updated Tag Manager Templates

These updates should not disrupt existing measurement or campaign performance. However we do recommend updating or implementing relevant solutions. For example, if you previously had a X Universal Web Tag (UWT) or Single Event Tag (SET) implemented, we recommend upgrading to the new X Pixel.

 

Conversion tracking solutions

There are two solutions to choose from:

  • The new X Pixel, which is a website tag that is implemented on your website to track site actions or conversions. 

  • The Conversions API, which is a direct, server-to-server integration that allows you to share data without the need for a website code implementation. 

Both solutions achieve the same goal and have largely the same functionality: enabling conversion tracking for your web campaigns. It is critical to implement or upgrade to at least one of these options in order to unlock the full capabilities of web campaigns. 

Choosing the right solution:

  • For most advertisers, we recommend using the X Pixel. If you are just getting started, the X Pixel can be the most straightforward solution to get set up. 

  • If you have key considerations with regards to your website (example: unable to implement JavaScript on your website), then the Conversions API may be the best option. 

Note: if you previously had an X Universal Web Tag or Single Event Tag implemented, they have been migrated to continue to function alongside the new X Pixel. Read more below.

Once conversion tracking is set up, you'll also be able to track cross-device conversions. This means even if someone viewed your Promoted Ad on their mobile device but converted on their laptop, the conversion will be accurately attributed to your campaign.

The new X Pixel

The new X Pixel is a website tag that is implemented on your website to track site actions or conversions. 

This new product combines our legacy web tags  - the Universal Web Tags (UWT) and Single Event Tags (SET) - into one, easier-to-use solution. Alongside this release, we have also introduced code-based event functionality (vs. events defined by URL rules).

The new X Pixel is made up of two parts:

  • Base code - similar to the Universal Web Tag, this should be implemented across all pages of your site. Any previously integrated Universal Web Tags are able to operate as the base code of the new X Pixel. The base code tracks visits to a website and initializes the pixel so that you can track additional events via event code or create audiences using Audience Manager.

  • Event code - requires the base code to be implemented. Similar to Single Event Tags, event code should be implemented in key locations (like an add-to-cart button). Any previously integrated Single Event Tags have been transitioned to operate as event code of the new X Pixel. Event code allows you to track individual actions on your website, like Purchases.

You have two options to implement the X Pixel - via direct integration or via a supported 3rd party Tag Manager. Read more below

(i) Previously implemented the Universal Web Tag and/or Single Event Tag? With the transition mentioned above, any implemented measurement should continue to operate as before. However, we still strongly recommend updating your implementation in order to access new functionality now and in the future.

To update your existing implementation by directly implementing code, follow the instructions on this page, and paste over any previously implemented code with the new base code and/or event code(s). If using a Tag Manager, replace your previous setup with their updated X templates.

Conversion API

Conversion API (CAPI) is a measurement solution that allows a direct, server-to-server connection to share conversion data with X to enable the measurement of X campaigns. 

Conversion API increases measurement options and provides you with control over what data is shared. This is a complementary measurement solution to the new X Website Pixel and can be used with or without the Pixel.

Multiple data signals with Conversion API (CAPI) can be used—including X Click ID or email addresses to send conversion events to the API endpoint.

Note: 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 X 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.

 

Setting up the X Pixel

Setting up the X Pixel requires:

  1. Generating the Pixel itself

  2. Creating events to track

  3. Implementing the base code across your website

  4. Implementing event code in key locations on your website (example: on an add-to-cart button)

Generating the Pixel and creating events

1. Log into your ads account at ads.twitter.com

2. Under “Tools,” select “Events Manager”

  • Not seeing a Tools tab in your account? This is likely because a credit card hasn’t been added to your account. Find how to add one here.

3. If you have created a Pixel before you’ll be able to see the X Pixel in the left column list and you can skip to step 6

  • If you have never created a Pixel on X before, you will need to add an event source. In “Events Manager” click on “Add event source”. 

4. This option is also accessible via the settings tab if you previously created a Pixel

  • You are now in the “Install pixel code” page. Here you have the option to deselect “Allow 1st-party cookies” if you choose. 

(i) The “Allow 1st-party cookies” check box enables our Click ID functionality to leverage first-party cookies on websites. Specifically, this enables measurement of conversion events beyond landing page visits. This first party cookie will store the Click ID parameter appended to your landing page URL in order to measure the conversion events that take place on your website.

This option is required to access the full functionality of future Conversion Optimization and Dynamic Product Ad solutions, as the data would be used for campaign optimization. Read more about Click ID here and about how we leverage cookies here.

Note that this option is default on. It can be turned off by de-selecting the “Allow 1st-party cookies” option.

5. Click the “Save event source” button to save your new Pixel. You will be brought to the “Events Manager” main screen.

  • Note: if you previously set up events using the Universal Website Tag or Single Event Tags, they will appear as events here. We do still recommend upgrading their pixel codeand enabling event parameters where relevant. 

6. 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 automobile dealership may want to implement “Lead”.

  • Read more about available conversion events and parameters here.
  • Note: if you previously created a Single Event Tag, they will still appear in “Events Manager”. To re-use them and update the code, skip to the “Event Code Implementation” section. If you would like to create new events to replace any previously made Single Event Tags, continue to follow the steps below.

7. Click the “Add events” button.

Note: Advertisers creating X Pixel events for Dynamic product ads are required to add the following conversion events:

  • Page View 
  • Content View
  • Add to Cart
  • Purchase

8. 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. Click “Next”

9. On the “Setup method” screen, you will be able to choose how you want to define your event. We recommend defining your event with code as this will provide you the most flexibility. For example, it allows you to send key information back via event parameters. Select “Define event with code” and click “Next”.

10. 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 is provide 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 “Save” to save your newly created event.

Note: 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.

11. Repeat steps 7 to 10 to create events for all the relevant actions you would like to track.

  • In almost all cases, a particular conversion type (i.e. Purchase or Download) should only be used once on your website. Creating several conversion events of the same conversion type leads to bifurcating of signal and will lead to an inefficient optimization setup.
  • Advertisers defining event code implementation for Dynamic Product Ads campaigns are required to select the following parameters 
    • Contents (choose this for all events)
    • Value (choose for Purchase event, it denotes purchase value)
    • Currency (choose for Purchase event, it denotes purchase currency)
    • Email (choose this for all events)

After doing the above, you will need to implement your newly created Pixel base code and event code in order to start tracking actions. 

Implementing the X Pixel

You can choose to implement the X Pixel base code and event code either by:

  • Direct: by downloading and integrating the code provided on a website.

  • Tag Manager: by leveraging an approved 3rd party Tag Manager.  

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.

Base Code Implementation

1. In “Events Manager”, near the top of the page, click on “View base code” for the pixel you would like to implement.

2. In the “Install pixel code” page, make sure the “Install with Pixel code” tab is selected.

3. From here, copy or download the Pixel code in the “Pixel code” field. 

  • To download, click on “Download pixel code” underneath the field.

4. 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.
  • Note: if you have previously implemented a Universal Web Tag and want to upgrade your implementation, paste over the previously implemented code across your site with the new code that you copied or downloaded.

Once you implement the base code, we will auto-create a “Site Visit” and “Landing Page View” event that measure a visit to a website or a view of the ad landing page, respectively. These can be found in “Events Manager”. Read more about these events and updates to our Website Traffic events here.

 

Event Code Implementation

1. In “Events Manager”, find the event you would like to implement.

2. Click on the three (3) dotgs next to the event name and select “Edit event”.

3. Click “Next” twice to go to the “Event installation” screen. 

4. Click on “Download code snippet” under the “Code” field. 

5. Add this code to specific elements of your website (like a thank you page or “download” button).

  • If you are using event parameters, update default values when you install the code on your website. 
  • Note: if you have previously implemented a Single Event Tag and want to upgrade your implementation, paste over previously implemented code with the new event code(s) that you copied or downloaded.

6. Repeat steps 1-5 for each event you would like to track.

Implementing pixel code of multiple accounts on the same page

If you are using more than one ads account for marketing your website, you may end up needing to add multiple base code and event code 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 →
    

Using Events in Campaigns

Once a conversion event is created, you will be able to select it from the campaign form.

To do this:

a. Select “Create a new campaign” from your ads account

b. After filling out the campaign details, you will be prompted to fill out your ad group details

c. While completing ad group details,  selecting “Website conversions” under “Optimization preference”. This will create a new field “Key conversion metric” where you can select your conversion event.

For more help with the campaign form, check out these step-by-step instructions for creating a website traffic campaign.

 

Event types and parameters

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. Click on the drop downs below to see the available events and parameters:

Event types

Parameters

Event types

Page View (formerly Site Visit), Purchase, Download, Custom, Lead*, Add to Cart, Checkout Initiated, Content View, Added Payment Info, Search, Subscribe, Start Trial, Add to Wishlist, and Product Customization.

Parameters

Contents, Conversion ID, Email address, Value, Currency

*The previous Sign Up event is now renamed to “Lead”. A lead can be any data submission performed by a customer, such as sign ups, reservations, form completions, etc.

Event Types

Setting the right event is important. It helps signal to X what type of action you are measuring and can inform the type of optimization our system uses when delivering ads. 

Because of this, events are the backbone of lower-funnel products. If you are interested in leveraging future lower-funnel products like Conversion Optimization and/or Dynamic Product Ads, it will be important to set up events, with parameters, in key places on your website.

In almost all cases, a particular conversion type (i.e. Purchase or Download) should only be used once on your website.

 

Website Traffic Event Updates

New! As of August 2022, all previous “Site Visit” event types are now renamed to “Page View” event types.

Just like before, you can customize Page View event types based on rules you set. Additionally, once the X Pixel base code is installed, we auto-create new X-defined “Site Visit” and “Landing Page View” events that measure a visit to a website or a view of the ad landing page, respectively. 

Check out the FAQ for more guidance on what event to use in a campaign. 

Old

New

Definition

Old

Site Visit event type

New

Page View event type

Definition

Advertiser-defined Page View event type. The definition of this event can vary based on what rules an advertiser sets. Example: count a page view when the user visits a page that contains ‘adopt-a-pet/learn-more’


All existing events of type ‘site visit’ are renamed to type ‘page view’. No other changes to the events itself. 

Old

New

Site Visit

Definition

X-defined, auto-created event, that measures a visit to the advertisers website (regardless of if it’s the ad landing page or not) after viewing or clicking on an ad. 

Old

New

Landing Page View

Definition

X-defined, auto-created event that measures a view of the ad landing page after click on an ad. 

(i) How does this affect Site Visit Optimization? The optimization model will remain the same, however there are some reporting considerations to keep in mind. 

  • Optimization: there is no impact to current campaign optimization as a result of the above event updates. 

  • Site Visit to Page View Rename: current campaigns will still be optimizing towards the same events as they were before this change, however events tied to those campaigns will appear as “Page View”.

  • Reporting: you may notice a difference in volume related to recent deduplication logic updates. They may also need to leverage the new “Page Views” metric when looking at reporting.

  • New events to optimize towards: you can now use the new auto-created Site Visits and Landing Page View events, in addition to Page View events, when using Site Visit Optimization.

Deduplication Rules

As of August 2022, we have also updated our deduplication rules. We made these changes to better align our logic with the broader standard and help provide more insight into the full impact of Web campaigns.

Event type

Old dedupe logic

New dedupe logic*

Event type

Page View

(incl. X-defined Site Visit & Landing Page View)

Old dedupe logic

1 hour

New dedupe logic*

30 minutes

Event type

Other event types

(Purchase, Lead, etc.)

Old dedupe logic

1 hour

New dedupe logic*

No longer deduping. Read more about this change in the FAQ

We have also released a deduplication key parameter alongside these updates. 

This can be used to manage event duplication as desired. 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:

Deduplication Key

      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

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 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. 

Event parameter

Description

Data type

Event parameter

value

Description

Total value of the conversion event (ex: $ value of the transaction in case of a purchase, the LTV value of a lead, etc.)

Data type

Integer or float

Event parameter

currency

Description

ISO 4217 code (e.g. USD, JPY, EUR)

Data type

String

Event parameter

conversion_id

Description

Unique identifier for the event that can be used for deduplication purposes

Data type

String

Event parameter

search_string

Description

Text that was searched for on your website

Data type

String

Event parameter

description

Description

A string description for additional info

Data type

String

Event parameter

twclid

Description

X click ID that can be included with any request.

The X 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.

Data type

String

Event parameter

status

Description

Status of the sign up or subscription, could be “started” or “completed”

Data type

String

Event parameter

contents

Description

Array of JSON Objects representing multiple products/content

See below for sub-parameters that can be included in the array.

Data type

Array of Objects

Sub-parameters

Event parameter

Description

Data type

Event parameter

content_type

Description

Category of the product purchased (Google product taxonomy)

Data type

String

Event parameter

content_id

Description

For product catalog users: please pass SKU


For all other users: Please pass Global Trade Item Number (GTIN) if available, otherwise pass SKU

Data type

String

Event parameter

content_name

Description

Name of a product or service

Data type

String

Event parameter

content_price

Description

Price of a product or service

Data type

Integer or float

Event parameter

num_items

Description

Number of products purchased

Data type

Integer

Event parameter

content_group_id

Description

ID associated with a group of product variants

Data type

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 →
    

User parameters

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 X Pixel or Conversions API.

  • Note: the X Pixel automatically hashes these parameters, using industry standard SHA256 hash. No unhashed data is shared to X.
  • Note: include the phone number in the following format: country code (example: +1, +32, etc.) followed by the phone number. For example, for a US phone number: +11234567890

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: 'test_email@twitter.com',
    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 →
    
 

Analytics

Once you’ve set up the X Pixel, reporting for website conversion tracking is available in the "Campaigns" tab.

You’ll see the number of conversions driven at the campaign or post level, as well as related metrics such as impressions, engagements, spend, and CPA.

You can see results for your conversion events by selecting "Customize Metrics". 

Then, scroll to the "Conversions" section of customizable metrics, and select the conversion event types you want to view. 

These analytics are also available via a downloadable .csv file under "Export Data" within Ads Manager. 

The campaign dashboard will show conversions by conversion type. For example, if you're interested in tracking two different types of purchases, you may want to set one up as “purchase” tag and the other as a “custom” tag to report on the two separately.

Otherwise, the downloadable .csv offers an option to break out conversions by conversion event name. Post-view and post-engagement conversions are also broken out separately. To do this, select "Website Conversions by tag" when exporting your metrics.

Attribution windows

Post-engagement attribution windows: Select the time window for crediting X with conversions that happen after a person engages with your ads. Some examples of engagement can include likes, Retweets, follows, replies, or URL clicks. 

The options for post-engagement attribution windows are 1, 2, 3, 5, 7, 14, and 30 days. If you’re not sure which window to select, we recommend the default setting of 30 days. If you change this setting, your conversion data will be retroactively updated, so feel free to come back later and experiment with different attribution windows.

Post-view attribution window: “Post-view” refers to when someone on X sees your Promoted Ad and does not engage with it, but later visits your website and converts. People on X often see, read, and view media in your Promoted Ads without clicking on them. As such, including post-view attribution gives you insight into conversions you received but weren’t actually charged an engagement for.

The options for post-view attribution windows are Off, 1, 2, 3, 5, 7, 14, and 30 days. If you’re not sure which setting to choose, we recommend the default of “1 day after view”.

 

Custom Audiences

Website Activity Audiences from the X Pixel enable you to reach people on X who recently expressed interest in your products by visiting your website. Website Activity Audiences uses the same X Pixel for conversion tracking from this page. Learn more about Website Activity Audiences.

 

Troubleshooting

 

Restricted Data Use Parameter

Restricted Data Use (RDU) parameter enables an advertiser to limit X’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.

Events Manager

Once you’ve placed the X Pixel, return to the "Events Manager" tab in X 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:

  • Active: Activity has been detected within the last 24 hours

  • Inactive: Activity has not been detected

  • No recent activity: Activity has not been detected within the last 24 hours

Recent Activity Log

Once your Pixel has been implemented and it starts sending events to X 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:

  1. In the Events Manager, hover over the three dots next to the event you want to verify and select "View Activity" from the drop down menu;
  2. The Recent Activity Log will open showing a sample of the data we received from that event over the past few hours;
  3. Hover over each of the line items to check the time that event was received, which parameters it is sending (if any is set) and the host name of the website that is sending those events.

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 X 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.

Pixel Helper

If you notice any issues with an implemented Pixel, we also recommend leveraging the X Pixel Helper, a Google Chrome extension. The Pixel Helper shares the tracking status of the X Pixel and relevant events and includes error codes depending on what the issue may be.

Learn more about the X Pixel Helper here and download the extension here

Content security policy

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

Note: 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 X Pixel.

 

Tag managers

Please note: third-party interfaces may not reflect the capabilities of our website tracking in X Ads Manager, and they may only pertain to information collected by that third-party.

Google Tag Manager

Note: The ‘X Universal Website Tag’ template will be deprecated. Instead, please search for the X Base Pixel template and X Event Pixel template in the Community Template Gallery.

Create base pixel:

Note: Only create a base pixel once

  1. Select “Tags” from the left-hand navigation menu and click “New” and click “Tag Configuration”

  2. When prompted, select “Discover more tag tag types in the community template gallery” and search for X Pixel Base Pixel

  3. Give your tag a title. Otherwise, it will default to “Untitled Tag”.

  4. Within the X Ads UI (ads.x.com), log into your ads account and click Tools > Events Manager and select “Add event source” > Install with Tag Manager

  5. Copy and paste the pixel ID into the X Pixel Base tag template

  6. Add necessary user parameters and page location in the X Pixel Base tag template

  7. Choose trigger named “All Pages - Non-blocking (Asynchronous)” with type Page View

Create event pixel:

Note: Make sure that you create a base pixel before creating event pixels

  1. Select “Tags” from the left-hand navigation menu and click “New” and click “Tag Configuration”
  2. When prompted, select “Discover more tag types in the community template gallery” and search for X Pixel Event Pixel
  3. Give your tag a title. Otherwise, it will default to “Untitled Tag”.
  4. Within the X Ads UI (ads.x.com), log into your ads account and click Tools > Events Manager and select “Add event” and fill out the given form. Then, choose “Install with tag manager”.
  5. Copy and paste the event ID into the X Pixel Event Tag template
  6. Add necessary user parameters, event parameters, and page location
  7. Add the necessary triggers to have the tag event load on a specific set of actions.
  8. Complete similar steps for all stages of the site — i.e. do not fire 'PageView' tag event when the 'Purchase' tag event fires.
  9. Expand the Timing Settings (Optional) section and in the "CHOOSE WHICH TAGS MUST FIRE FIRST" field, find and select your Twitter Base Pixel that was just created.

Ensighten

Note: The ‘X Conversion Tracking (UWT)’ app will be deprecated. Instead, please use the X Pixel template.

Create a base pixel:

Note: Only create a base pixel once

  1. From your Ensighten dashboard, choose “Apps” and search for the “X Pixel” within the Ensighten library

  2. Give your tag a title

  3. Choose “Base Pixel”

  4. Within the X Ads UI (ads.x.com), log into your ads account and click Tools > Events Manager and select “Add event source” > Install with Tag Manager

  5. Copy and paste the pixel ID into the Pixel ID field

  6. Add necessary user parameters and page location

  7. Choose “All Pages” as the condition/event for this tag

  8. Save tag

Create an event pixel:

Note: Make sure that you create a base pixel before creating event pixels

  1. From your Ensighten dashboard, choose “Apps” and search for the “X Pixel” within the Ensighten library

  2. Give your tag a title

  3. Choose “Event Pixel”

  4. Within the X Ads UI (ads.x.com), log into your ads account and click Tools > Events Manager and select “Add event” and fill out the given form. Then, choose “Install with tag manager”.

  5. Copy and paste the event ID into the X Pixel Event Tag template

  6. Add necessary user parameters, event parameters, and page location

  7. Add the necessary conditions and events to have the tag event load on a specific set of actions.

  8. Complete similar steps for all stages of the site — i.e. do not fire 'PageView' tag event when the 'Purchase' tag event fires.

  9. Save tag

Tealium iQ

Note: The logic for the X 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.

  1. Navigate to the Tags from the left-hand navigation menu and click the Add Tag button.

  2. When the Marketplace appears, use the search bar to locate the X Pixel.

  3. Select the green +Add button.

  4. If necessary, rename your pixel. Otherwise, proceed to the next step for configuration.

  5. Within the X Ads UI (ads.x.com), log into your ads account and click Tools > Events Manager, and select Add event source > Install with Tag Manager. Copy the base Pixel ID.

  6. Paste your pixel ID into the Pixel ID tag configuration field in Tealium.

  7. Select any Load rule conditions for pages you wish to fire the X Pixel on. Use the default Load on all pages rule to trigger the Base Pixel on each page.

Create an Event Pixel trigger:

  1. Select Data Mappings from the top of the Configuration window.

  2. Select a variable from the dropdown whose value will trigger the specific Event Pixel. In this example, page_name will be used to invoke a conversion event.

  3. Click the + Select Destination button.

  4. In the category mapping on the left side of the window, select Events.

  5. In the when mapped variable equals field, enter in the value of the variable. In Tealium’s example, confirmation will be used.

  6. Within the X Ads UI (ads.x.com), log into your ads account and click Tools > Events Manager, and select Add an event or Edit an event. Then, choose to Install with a tag manager to copy the event id.

  7. Copy the Event ID from your X account and paste it into the Event Code ID field in your Tealium configuration. This will enable the initial trigger for that event.

  8. Additional variables can be mapped to align with the Event ID. One common example is sending Order IDs with a conversion event. This mapping will take place in the Event-specific Parameters section of the Data Mapping window.

  9. Using Order ID as an example, follow steps 2 and 3 above to select the order_id data layer variable. Then, under the Event-specific Parameters tab, map it to the X Order ID Parameter and enter your conversion Event Code ID.

*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 integrations

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 AdobeTealium, Metarouter, and Datahash. If you already work with one of those partners you can follow the links above to their documentation to learn how to integrate with X'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.

 

Frequently asked questions

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.

Click ID is a unique identifier that is automatically appended in the URL to help improve our ability to attribute site actions. Read more about Click ID here.


Note: 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 X Pixel.

Generally, we recommend using the "URL Contains" match rule over the "Exact URL" match rule, as the latter looks to match the URL exactly as given, including URL query string parameters and the protocol of the page (i.e. ‘http’ and ‘https’). URL string query parameters can vary between users and site navigation paths, so we recommend you only select ‘Exact URL’ in very rare and specific use cases.

For advertisers creating X Pixel events for Dynamic Product Ads campaigns are required to add the following conversion events:

  • Page View (formerly Site Visit) - used to track when a user lands on a page featuring multiple products (e.g., a browse experience on your website like the Sale/Clearance page)
  • Content View - used to track when a user clicks on or views a product/product details page. This event should capture a user intentionally viewing with a specific product id
  • Add to Cart - used to track when a user adds a product to their shopping cart
  • Purchase - used to track the products being purchased 

For all other use cases, we recommend the following:

  • Auto-created Site Visits: You should consider selecting this when you want to maximize traffic to your website (all pages). We generally recommend leveraging this event when using Site Visit Optimization.
  • Auto-created Landing Page View: this should be used when you want to drive traffic to the click-through destination (i.e. landing page) of your ads, as opposed to driving traffic to the entirety of their website. This can be particularly useful for mid-funnel ads featuring a specific product and leading to a product details page. 
  • Page View: should be selected when interested in driving traffic to some subset of your website, as defined by URL matching rules set to a Page View event (previously called Site Visits). 

X reporting is finalized within 24-48 hours of when impressions are served. Before that time, we estimate data to provide real-time feedback, but the data is subject to change. The X conversion reporting UI has two process pipelines to display data.

First, a streaming job directly collects page visits and purchase events from live log data and pulls metrics into reporting. Then, an ongoing batch process removes duplicate tag fires, adjusts conversion attributions, and handles identity merging for multi-device conversions.

Ready to get started?