How to install the X Pixel
This guide walks through installing the X Pixel on your website, setting up conversion events like leads and purchases, and checking that it works before you spend money on X.
Intermediate·About 45 minutes·Reviewed November 2026
The X Pixel is a snippet of JavaScript that tells X when someone who saw or clicked your ad visits your site and takes an action. Without it, X can report clicks but not leads or sales, and campaigns can’t optimize toward them.
X also offers a Conversion API that sends events from your server. X says the pixel suits most advertisers and the two can run together. This guide covers the pixel and how to prepare for the API.
Open Events Manager
Log in at ads.x.com and go to Tools, then Events Manager. If you don’t see a Tools tab, X says a credit card probably hasn’t been added to the account yet. Add billing first, then come back.
Create the pixel
Click Add event source and accept X’s terms. X generates your base pixel and automatically creates two events, Site Visits and Landing Page Views, which track visits once the base code is installed.
If your account already has a pixel, use it. One pixel per site keeps your data in one place.
Install the base code on every page
Open the pixel’s website code in Events Manager and copy it. Paste it before the closing head tag on every page of your site, outside any iframe. Most site builders and themes have a header code field that applies it site-wide.
If you use Google Tag Manager, X has a partner integration in Events Manager that connects your GTM container and can deploy the pixel, the Conversion API, or both.
Add a conversion event
In Events Manager, click Add events. Give the event a clear name, then choose a type. X’s types are Page view, Add to cart, Lead, Added payment info, Purchase, and Custom. You can adjust the attribution window and turn on Website activity audience to build a retargeting audience from it. Click Create Event.
TipUse each conversion type once per site. X notes that separate events of the same type split the signal.
Install the event code where the action happens
X recommends defining events with code for the most flexibility. Copy the event code from Events Manager and fire it when the action happens, such as on the thank-you page after a form or order. Event code needs the base code on the same page.
For purchases, pass the real order value and currency. Templates from the parameter checkboxes are placeholders until your code fills in real values.
Add a conversion ID and customer details
Pass a unique conversion_id with each event, such as the order or lead ID. X uses it to match the same event sent by both the pixel and the Conversion API.
You can also pass email address and phone number. X says the pixel hashes them with SHA256 automatically, and phone numbers need a country code. Only send data your privacy policy and consent setup allow.
Test with X Pixel Helper
Install X Pixel Helper, X’s Chrome extension, then load your site. The badge shows how many pixels it detected, and the panel shows events and warnings. Complete a test lead or order and confirm the event fires.
In Events Manager, status shows Active when activity arrived in the last 24 hours. Open View Activity on an event to check timestamps and parameters.
Watch outIf calls show as blocked, your Content Security Policy is likely stopping them. X lists ads-twitter.com, ads-api.twitter.com, and analytics.twitter.com to allowlist.
Plan for the Conversion API
The Conversion API sends events server to server, so it doesn’t depend on the browser. It needs X Ads API access and a developer account, or a partner integration. Each event needs at least one identifier: X Click ID, hashed email, or hashed phone. If you run both, send the same conversion ID in each so X can deduplicate.
Before you move on
- The base code loads on every page, in the head
- Each conversion type is set up once, firing on the right page or action
- Purchases pass real value and currency
- X Pixel Helper shows the pixel with no warnings
- Events Manager shows the events as Active
Official resources
- X Business: Conversion tracking for websites
- X Business: X Pixel Helper
- X Developer Platform: Conversion API for Web
Ad platforms update their tools often. This guide was last reviewed against the official documentation above in November 2026. If your screen looks different, the official help pages have the latest steps.
At a glance
- Level
- Intermediate
- Time
- About 45 minutes
- What you need
- An X Ads account with a payment method added
- Access to edit your site's code or tag manager
- A list of the actions you want to count, such as leads or purchases
- Google Chrome, for the X Pixel Helper extension
Rather have it done for you?
Active Digital Marketing builds and manages X ad accounts for businesses doing $25,000+ a month in revenue.
Apply to work with usOr get an ad account auditWhere DIY setups go wrong
The most common problems with self-built X Ads setups, and what they cost.
Firing a lead event on a page anyone can load
If the event fires on a page people reach without converting, X counts false conversions and optimizes toward the wrong people. Fire it only after a real submission or order.
Running the pixel and API without a shared ID
X only deduplicates Page View events on its own, within 30 minutes. Leads and purchases sent twice without a matching conversion ID can be counted twice.
Breaking the click ID with redirects
X notes that click trackers, URL shorteners, and redirects on your ad's landing URL can break the click ID, which costs you attributed conversions.
Judging results in the first day
X says conversion reporting is finalized within 24 to 48 hours. Earlier numbers are estimates, so don't pause campaigns on a partial day.
What this guide doesn't cover
A firing pixel is the minimum. Whether X’s reported conversions match your real leads and sales depends on deduplication, consent handling, and comparing X’s numbers with your CRM or store.
Active Digital Marketing sets up tracking across X and Meta, including server-side events, and judges every channel on cost per qualified lead and profit rather than platform-reported results.
- Conversion API setup and match quality
- Consent and privacy handling for tracking
- Sending lead quality and closed deals back into reporting
- Reconciling platform conversions with your CRM or store
- Dynamic product ads events and catalogs
Common questions
Where is the X Pixel in Ads Manager?
Under Tools, then Events Manager. If there's no Tools tab, add a payment method to the ads account first.
Do I need the Conversion API as well as the pixel?
Not to start. X says the pixel suits most advertisers. The API helps when browser tracking misses events or you can't run JavaScript, and it can run alongside the pixel.
How do I know the X Pixel is working?
Use the X Pixel Helper Chrome extension on your site, then check that events show as Active in Events Manager and review their activity log.
Does the X Pixel work with Google Tag Manager?
Yes. Events Manager has a Google Tag Manager partner integration that connects your container and can deploy the pixel, the Conversion API, or both.
Keep learning
How to Create an X Ads Account
How to create an X Ads account: pick the right handle, set country and time zone, add billing, give your team access, and avoid settings you can't change.
Read the guideHow to Create an X Ads Campaign
How to create an X ads campaign: choose an objective, set budgets and bids, target the right audience, pick placements and posts, then launch.
Read the guideHow to Set Up X Lead Gen Ads
How to set up X Lead Gen Ads: build a lead form, launch a Leads campaign, and get leads from the Leads Center into your CRM, step by step.
Read the guideHow to Install the Meta Pixel and Conversions API
Install the Meta Pixel, add the Conversions API, set up conversion events, and confirm everything works with Test Events in Events Manager.
Read the guideHow to Set Up Google Ads Conversion Tracking
Install the Google tag, create conversion actions, turn on enhanced conversions, add consent mode, and confirm it works with Tag Assistant.
Read the guideHow to Install the TikTok Pixel
Install the TikTok Pixel with Shopify or manual code, add the Events API, and check events fire with Pixel Helper, Test Events, and Diagnostics.
Read the guideRather have it built right the first time?
If your business does $25,000+ a month in revenue, apply and Mitch will review your accounts personally. Earlier than that? An ad account audit gives you a senior-level fix list you can work through yourself.
