Asset 20 8 2
Does AI recommend your business? Run the free check →

Join 15,000 business owners, marketers and entrepreneurs. The Sunday newsletter you'll be annoyed only arrives once a week.

Article

X Pixel (Twitter Pixel): Setup, Events and How to Check It Works

The Twitter pixel, now the X Pixel, is a tag you add to your website so X can track what people do after seeing or clicking your ads, such as purchases or sign-ups. You create it in X Ads under Tools, then Events Manager, add the base code to every page and add event code where actions happen. X recommends the pixel for most advertisers, with its Conversion API as the server-side alternative.

Without it, X can tell you who clicked an ad but not who bought. Here's the setup from X's own business help page, plus the checks that save you from a campaign optimising on missing data.

X Pixel or Conversion API?

OptionHow it worksBest for
X PixelA website tag that tracks actions in the visitor's browserMost advertisers; X calls it the most straightforward to set up
Conversion APIA direct server-to-server connection, no website codeSites that can't run JavaScript, or teams with server-side tracking

X says both do largely the same job and you need at least one to get the most from web campaigns. If you're unsure what server-to-server means, my explainer on APIs and webhooks covers the basics.

The two parts of the pixel

  • Base code goes on every page of your site. It tracks visits and starts the pixel, and once it's live X automatically creates Site Visit and Landing Page View events.
  • Event code goes where specific actions happen, such as an add-to-cart button or a thank-you page. It needs the base code to work.

How to create the X Pixel

  1. Log in to your ads account at ads.x.com.
  2. Under Tools, choose Events Manager. No Tools tab? X says that's usually because there's no card on the ads account yet.
  3. Click Add event source and agree to X's terms. Your base pixel is created, with Site Visit and Landing Page View events.
  4. Click Add events, name the event, choose its type, set the attribution window and, if you like, switch on Website activity audience. Click Create Event.
  5. Pick how to install it: directly in your site code, through a supported tag manager such as Google Tag Manager, or by Conversion API.
  6. Repeat for each action you want to track.

Installing the code

In Events Manager, open View Twitter pixel, copy the pixel code and paste it before the closing head tag on every page. Then, for each event, click View install code and add that code to the right element or page. If more than one ads account tracks the same site, X shows how to bundle their codes in one script.

Events and parameters you can track

Event typeTypical use
Page viewA key page such as pricing
Add to cartShop baskets
LeadForm fills and enquiries
Added payment infoCheckout progress
PurchaseCompleted orders, with value and currency
CustomAnything else you define

Parameters add detail to each event, such as the order value, the currency, a search string or the products bought. X's tip: use each conversion type, such as Purchase, only once on your site, because duplicates split the signal and weaken optimisation. Parameters only work on events defined with code, not on events defined by URL rules.

Running pixel and Conversion API together

If you send the same events both ways, X strongly recommends a deduplication key: pass a conversion_id parameter in both the pixel and the API request so a sale isn't counted twice. You can also send email addresses and phone numbers; X says the pixel hashes them automatically with SHA256 so no unhashed data is shared.

How to check your pixel is working

Go back to Events Manager. Each event shows one of three statuses:

StatusWhat it means
ActiveActivity detected in the last 24 hours
No recent activityNothing detected in the last 24 hours
InactiveNo activity detected

For a closer look, hover over the three dots next to an event and choose View Activity. The Recent Activity Log shows a sample of events from the past few hours, with the time, the parameters sent and the website that sent them. X also offers the X Pixel Helper, a Chrome extension that shows the pixel's status and error codes.

Retargeting with the same pixel

The pixel does a second job: Website Activity Audiences. X says these let you reach people on X who recently visited your website, using the same X Pixel you installed for conversion tracking, so there's nothing extra to add. Switch on Website activity audience when you create an event, and you can later show ads to people who viewed a product, started a checkout or read your pricing page.

Work with me

Want AI doing the heavy lifting in your marketing?

I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.

If the pixel won't fire

  • Check the base code is on every page, before the closing head tag, not just the landing page.
  • Confirm the event code sits on the page or button where the action completes, such as the order confirmation page.
  • If your site uses a content security policy, X notes that its tags at platform.twitter.com redirect to static.ads-twitter.com, so allow that domain.
  • Remember the pixel only starts sending data the first time someone visits a tagged page.

Privacy controls

X's Restricted Data Use parameter lets you limit how X uses certain data, for example for visitors who have opted out or in regions where specific laws apply. Check it with whoever handles your cookie consent before you go live.

My verdict

Install the X Pixel before you spend anything on X ads, add one Purchase or Lead event, and confirm it shows Active in Events Manager after a test visit. That alone tells you whether X sends buyers or browsers. Then judge X against your other channels on cost per sale, not clicks; my guide to measuring social media ROI shows how.

Frequently asked questions

Is the Twitter pixel the same as the X Pixel?

Yes. X's help pages call it the X Pixel, though some screens in Events Manager still say View Twitter pixel.

Where do I find the X Pixel?

Log in at ads.x.com, open Tools, then Events Manager. If there's no Tools tab, add a card to the ads account first.

Do I need the X Pixel or the Conversion API?

At least one. X recommends the pixel for most advertisers and the Conversion API for sites that can't run JavaScript or prefer server-to-server tracking.

How do I know my X Pixel is working?

Check the event status in Events Manager: Active means activity in the last 24 hours. Use View Activity or the X Pixel Helper Chrome extension for detail.

Published and maintained by the Lilach Bullock team, covering marketing, AI and business growth.
Your buyers are asking AI who to use. Does it say you?

See for free whether ChatGPT, Claude, Perplexity, Gemini and Google name you, and get the plan to become the answer.

Check my AI visibility →
Sundays only

Get the Sunday newsletter.

One email a week. AI experiments, marketing tactics, and the workflows Lilach is building right now in her own business.

Subscribe free

Let’s get your marketing running on AI.

Book a free 30-minute call

We figure out what you need, where AI fits in, and what working together would look like.

Book the call →

Or take the 30-second calculator

You’ll see the hours and the money quietly leaking out of your week, and the three workflows worth building first.

Take the calculator →

Or grab the free AI resource library

Prompt packs, templates, checklists, and swipe files. The exact tools I build for paying clients. Yours, free.

Get the library →
Keep reading

More from the blog.