X (Twitter) Pixel Tracking Setup for WooCommerce
Quick answer: Use the free container builder wizard to select X (Twitter) Pixel and your events, enter your tracking ID, then import the generated file into Google Tag Manager - no manual tag setup needed for any of the 23 events below.
X Pixel base code and standard events, generated as Custom HTML. This platform does not have a native GTM tag type, so the container wraps its base code in a Custom HTML tag.
Build my X (Twitter) Pixel container →
Events you can track
ecommerce events
- X (Twitter) Pixel Page View event setup
- X (Twitter) Pixel View Item event setup
- X (Twitter) Pixel View Item List event setup
- X (Twitter) Pixel Add to Cart event setup
- X (Twitter) Pixel Remove from Cart event setup
- X (Twitter) Pixel Begin Checkout event setup
- X (Twitter) Pixel Add Payment Info event setup
- X (Twitter) Pixel Purchase event setup
- X (Twitter) Pixel Refund event setup
- X (Twitter) Pixel Add to Wishlist event setup
- X (Twitter) Pixel Coupon Applied event setup
- X (Twitter) Pixel Search event setup
- X (Twitter) Pixel Login event setup
- X (Twitter) Pixel Sign Up event setup
engagement events
- X (Twitter) Pixel Form Submission event setup
- X (Twitter) Pixel Lead event setup
- X (Twitter) Pixel Phone Click event setup
- X (Twitter) Pixel WhatsApp Click event setup
- X (Twitter) Pixel Email Click event setup
- X (Twitter) Pixel Outbound Click event setup
- X (Twitter) Pixel Scroll event setup
- X (Twitter) Pixel File Download event setup
- X (Twitter) Pixel Calendly Booking Scheduled event setup
By Humayun Kabir Naim — Last updated: 9 November 2026
Quick answer
To track a WooCommerce store in X (Twitter) through Google Tag Manager, work in the opposite order to most pixels: first create your conversion events inside X's Events Manager — Purchase, Add to Cart, Lead and the rest — because X issues each one an event ID (tw-<pixel-id>-<event-id>), and a GTM tag without that ID fires an event X never defined. Then build in GTM: the X base pixel on every page via a Custom HTML tag (twq('config', …) — X has no native GTM tag type), one event tag per conversion calling twq('event', …) on the matching data layer event from the same GA4-format layer your other hubs use, and on Purchase, value and currency from the order plus the order ID as conversion_id — the value X deduplicates on if a server copy of the same purchase ever arrives. There is no official X plugin for WooCommerce, so GTM is not competing with a vendor sender here; the doubling risk comes from old theme snippets and all-in-one pixel plugins, which the checks below clear out first.
What gets tracked
X does not read GA4 event names, and it does not have a standard event for every step of the funnel. The table is the honest translation: the money events have real event types in Events Manager; the rest are Custom events you define yourself — still worth sending for audiences, but do not expect them to behave like Purchase.
| WooCommerce dataLayer event | X event (created in Events Manager) | Type in X |
|---|---|---|
| Page view (every page) | Base pixel — Site Visit / Landing Page View | Automatic from the base code |
view_item | View Content | Custom event |
add_to_cart | Add to Cart | Standard type: Add to cart |
begin_checkout | Checkout Started | Custom event |
add_payment_info | Added Payment Info | Standard type: Added payment info |
purchase | Purchase | Standard type: Purchase |
generate_lead / form success | Lead | Standard type: Lead |
sign_up | Sign Up | Custom event (or Lead, if it is your lead) |
search | Search | Custom event |
view_item_list | View Item List | Custom event |
| Order refunded in admin | — (no browser moment exists) | Server-side only, via the Conversions API |
Every event can carry parameters — but only if the event was defined with code in Events Manager. An event created with a URL rule ("fire when the URL contains /thank-you/") receives no parameters at all, which is why this guide defines every conversion with code. The parameters that matter on WooCommerce: value and currency on the money events, conversion_id on Purchase (the order ID — the deduplication key explained below), and contents, an array describing the products: each item's content_id, content_name, content_price, num_items, and optionally content_group_id and content_type.
Set expectations on contents correctly. X accepts product-level data, and clean product IDs keep product-level reporting and audiences open. But X has nothing like Meta's or TikTok's catalog-ads machinery learning from every event — no feed-matching discipline that silently breaks if your IDs drift. Send the WooCommerce product ID (or the SKU, if that is what your store uses everywhere else) and keep it consistent; that is the whole requirement.
Deep dives: Purchase, Add to Cart, Begin Checkout, View Item, Lead. Running GA4 too? Build the shared layer first: WooCommerce + GA4. See all options on the WooCommerce hub.
Before you start
- Create the events in X first. In your X Ads account, open Tools → Events Manager, add your website as an event source if needed, and create each conversion you plan to send — Purchase, Add to Cart, Added Payment Info, Lead, plus Custom events for View Content and the rest of the table. Choose the code setup for each and copy its event ID (
tw-…-…) into a note. Every other platform lets you skip this step; X does not — atwq('event', …)call naming an ID that does not exist in Events Manager is a call into the void. - Audit the store for existing X code. Unlike TikTok or Meta, X has no official WooCommerce plugin — but that does not mean nothing is sending. Search the theme and any header/footer injector plugin for
twqorstatic.ads-twitter.com, and check all-in-one pixel plugins: the popular pixel-manager plugins offer the X Ads pixel as a paid-tier feature, and a store that enabled it there already has a base pixel and a purchase sender. One sender must win: if a plugin is your sender, this GTM build should not happen; if GTM is, switch X off in the plugin and remove pasted snippets before publishing. - One pixel ID, everywhere. The pixel (event source) ID from Events Manager is the ID in the base tag, in every event ID, and in any later server setup. Stores that ran X ads years ago sometimes have an old "universal website tag" ID pasted somewhere alongside a newer pixel — two IDs means two half-empty event sources and reports that never agree.
- GTM installed, data layer working. One web container, and a data layer source (GTM4WP with WooCommerce enhanced ecommerce enabled) pushing the GA4-format events in the table —
view_item,add_to_cart,purchasewithecommerce.value,ecommerce.currency,ecommerce.transaction_idandecommerce.items. If your GA4 hub setup already works, X reads the same pushes. - Decide your product identifier.
content_idincontentsshould be the WooCommerce product ID or the SKU — pick the one your store already uses for its other catalog work and use it in every X event. Consistency is the requirement; either choice beats a mix.
Route 1: Use the free TagManagerBuilder container
Open the GTM Container Builder, choose WooCommerce, then X (Twitter) Pixel, and tick the events you want. Enter your Pixel ID and download the JSON, then in GTM go to Admin → Import Container and choose Merge → Overwrite conflicting tags, triggers, and variables. The container builds the base pixel and the event tags as Custom HTML — X has no native tag type in GTM. Two things the container cannot do for you: the events must already exist in your X Events Manager (Before you start, step 1), and after import you paste each event's tw-…-… ID into its tag — the builder knows your pixel, not the event IDs X issued to your account. If a GA4 or Meta container from this site is already in the workspace, import into the same workspace so the containers share the data layer variables. Clear any old snippet or plugin sender first (step 2 above), then test with the testing section before publishing.
One honest alternative to know about: Events Manager itself offers a Google Tag Manager partner install that provisions a container for you (client side, server side, or both) after you sign in with Google. It is a legitimate route — but it is X's own container setup, separate from the shared data-layer build your GA4, Meta and TikTok tags live in. Pick one architecture: the partner install or your own GTM build. Running both is the double-send this guide exists to prevent.
Route 2: Build it manually in GTM
Step 1 — The base pixel tag
Tags → New → Custom HTML, and paste the base code copied from Events Manager (copy yours — do not retype it; your pixel ID comes filled in). Its shape is:
twq('config', 'o1234');
Set the trigger to All Pages. This tag loads the pixel on every page, gives you the automatic Site Visit and Landing Page View events, and — the part that matters later — receives the twclid click ID when a visitor lands from an X ad, so subsequent events can be tied back to the click. A base tag missing from landing pages or firing late weakens attribution for everything downstream. (A community X template from the Gallery does the same job if you prefer templates; the TagManagerBuilder container uses Custom HTML. Either is fine — pick one, not both.)
Step 2 — Variables that translate the data layer into X parameters
In Variables → New, create Data Layer Variables (Version 2) for ecommerce.value, ecommerce.currency and ecommerce.transaction_id. Then a Custom JavaScript Variable called X Contents that reshapes ecommerce.items into X's contents array:
function() {
var items = {{DLV - ecommerce.items}} || [];
return items.map(function(item) {
return {
content_id: String(item.item_id),
content_name: item.item_name,
content_price: item.price,
num_items: item.quantity || 1
};
});
}
If your data layer carries SKUs in item_id and you chose product IDs (or the reverse), this variable is where the convention gets fixed — once, for every event.
Step 3 — One event tag per X event, keyed by its Events Manager ID
For each conversion, create a Custom HTML tag that calls twq('event', …) with the ID X issued for that event, on a Custom Event trigger matching the data layer event. The Purchase tag is the pattern:
twq('event', 'tw-o1234-p5678', {
value: {{DLV - ecommerce.value}},
currency: {{DLV - ecommerce.currency}},
conversion_id: {{DLV - ecommerce.transaction_id}},
contents: {{X Contents}}
});
Three details decide whether this works. First, the event ID is per-event, not per-pixel: the Add to Cart tag carries a different tw-…-… ID from the Purchase tag, each copied from its own Events Manager entry. Second, conversion_id is the order ID — stable, unique per order, and identical to what a server copy would send (Step 5). Third, trigger on the data layer event, never on a click or page view: the push is the only signal carrying the order's value and items.
Build the remaining tags the same way, changing only the event ID, trigger and parameters: Add to Cart (add_to_cart), Added Payment Info (add_payment_info) and View Content (view_item) with value/currency/contents as the table suggests, and Lead on your form-success event — with a per-submission conversion_id if you generate one, since a lead has no order ID to reuse.
Step 4 — Test before the server conversation
Run the testing section below end to end. X's browser-side reporting is unforgiving about one thing: an event that arrives with a mistyped ID is not flagged as broken — it simply never appears against the event you created. Prove each event against its own Events Manager entry before thinking about the Conversions API.
Step 5 — The Conversions API, honestly scoped
X offers a Conversions API: events sent server-to-server to an Ads API endpoint, either through X's official server-side GTM template ("X Ads Conversion API (Official)", server containers only) or from custom code with Ads API access. Each server event needs the Events Manager event_id, a conversion_time, and at least one identifier — the twclid, or a hashed email or phone number. Its deduplication rule is documented and simple: send the same conversion_id from the pixel and the server, and X counts the conversion once.
For most WooCommerce stores this is a later step, not the default: it needs a server container or Ads API credentials and identifier plumbing, and an ad programme large enough for the recovered conversions to matter. The browser build above stands on its own. What is not optional is the habit that makes the API safe to add later — the order ID already travelling as conversion_id on every Purchase. Stores that skipped it must re-tag before they can deduplicate; stores that did it just switch the server copy on.
Test it: GTM Preview, X Pixel Helper and Events Manager
- Click Preview in GTM and shop the store like a customer: product page, add to cart, checkout, test order.
- In the Preview timeline, click
view_item,add_to_cart, thenpurchase. Each X event tag sits under Tags Fired with its parameters resolved — check the Purchase tag'sconversion_idshows the test order's ID (1042), not "undefined" and not the pixel ID. - Install the X Pixel Helper Chrome extension and repeat the flow on the live store. It lists the pixel and the events as they actually fired, with their parameters — the fastest check that the base pixel loads once (a second base pixel listed here means an old snippet or plugin is still active).
- In Events Manager, open your event source and watch the events arrive from the test order. Each conversion should register against the event you created for it — Purchase against Purchase, with its value. An event showing in the Helper but never in Events Manager almost always means the
tw-…-…ID in the tag does not match the ID Events Manager issued (re-copy it; do not retype it). - Run the duplicate check deliberately: refresh the order-confirmation page once. The browser may well fire again — that is exactly the case
conversion_idexists for on the reporting side, and the reason the ID must be the order ID and not something random per page load. - Only when every event lands against the right entry, click Submit in GTM to publish. For the first days, compare Events Manager purchase counts against WooCommerce orders: X attributes conversions beyond the last click (engagements such as likes and reposts count inside its window), so X's number will run higher than your order count on ad-driven traffic — that gap is attribution, not duplication. Duplication is the opposite signature: counts roughly doubling against the same traffic.
WooCommerce-specific troubleshooting
Events fire in the Pixel Helper but never show in Events Manager. The tag is using an event ID that does not match the one Events Manager issued — a mistyped character, the ID of a different event, or an ID from an old pixel. Re-copy the ID from the event's own page in Events Manager; never retype it. Remember this platform's direction: the event exists in X first, and the tag only works when it points at that exact entry.
Every purchase counts twice. Find the second sender: search the page source and theme for twq outside GTM, and check pixel-manager plugins for an enabled X Ads pixel. X has no official plugin, so the second sender is always a leftover — an old universal-tag snippet in a header injector, or a paid plugin feature switched on during a trial. conversion_id deduplicates a pixel copy against a server copy; it is not a licence to run two browser senders.
Purchase arrives without value, or value is 0. The tag fired on a trigger that ran before the data layer push carried the order data — usually a page-view trigger on the thank-you page instead of the Custom Event trigger on purchase. Also check that your data layer plugin fills ecommerce.value on the purchase push; a tag mapped to an empty variable sends an empty value, silently.
Add to Cart works on some products but not others. AJAX add-to-cart: where the cart updates without a page load, some data layer setups skip the push. Test the exact button in Preview and watch for the add_to_cart push itself — if the push is missing, the X tag is innocent; fix the layer.
contents arrives empty or malformed. The Custom JS variable read ecommerce.items before the push populated it, or the items array uses different keys (id instead of item_id). Inspect the variable's resolved value in Preview on the purchase event — not on page view, where empty is expected.
Attribution looks inflated compared with WooCommerce. That is X's model, not your tags: conversions are credited after engagements beyond link clicks — likes, reposts, profile visits — inside its attribution window, so more X-reported conversions than orders is normal for ad traffic. The abnormal signature is the same order appearing as two purchases; check that with conversion_id values, not totals.
Next steps once this is clean: WooCommerce + TikTok and WooCommerce + Meta from the same data layer, then Consent Mode v2 so consent choices reach every tag correctly.
Frequently asked questions
Does X have an official plugin for WooCommerce, like TikTok and Meta do?
No. X publishes no WordPress or WooCommerce extension, so there is no official-plugin route to keep or remove. Third-party pixel plugins do offer the X Ads pixel (usually as a paid feature), and X's own alternative is its Events Manager partner install for Google Tag Manager. For a store already running GTM for GA4 and Meta, building X in the same container — this guide — keeps one data layer and one sender per event.
Why do I have to create the events in Events Manager before building tags?
Because X identifies conversions by IDs it issues, not by names you invent. Creating a Purchase event in Events Manager gives you its ID (tw-<pixel-id>-<event-id>), and your tag fires that ID. Skip the step and the tag calls an event X has never defined — the Pixel Helper may show a call leaving the browser, but nothing registers against a conversion in your account.
What is conversion_id, and why must it be the order ID?
conversion_id is the unique-per-conversion value X deduplicates on: when the same purchase arrives from the pixel and from the Conversions API carrying the same conversion_id, X counts it once. The order ID is the only value both sides already know, it is stable across confirmation-page refreshes, and it is unique per order — which is exactly the shape the key needs. A random per-load ID defeats it completely.
Does X deduplicate two browser copies, like a plugin plus GTM?
Do not rely on it. X documents conversion_id deduplication between the pixel and the Conversions API; two browser senders are a setup error, not a supported architecture — and with a plugin you often cannot even control which ID it sends. One browser sender (GTM), plus optionally one server sender sharing the order ID, is the only build this guide supports.
How much product data should I send in contents?
Send the essentials cleanly: each item's content_id (product ID or SKU — one convention, used everywhere), content_name, content_price and num_items. X accepts product-level data and it supports product-level reporting and audiences, but X does not run the kind of catalog-matching optimisation Meta and TikTok do, so there is no feed to "match or silently fail" — accurate IDs are worth doing, and gold-plating them is not.
Should I add the X Conversions API now?
Only if you already run a server GTM container or have Ads API access, and your X ad spend is large enough that browser losses are a visible problem. It is a genuine tool — X's official server template exists for it — but it is not the default for a typical WooCommerce store. Do the browser build properly first, with the order ID as conversion_id on every Purchase; that single habit is what makes adding the API later a configuration job instead of a re-tagging project.