X (formerly Twitter) remains a relevant advertising channel for brands in tech, media, entertainment, and consumer products. The X Ads pixel — now called the X Pixel — works similarly to other advertising pixels but has some differences in setup and event naming that are worth understanding before you install it.
X Ads Tracking Architecture
X Ads uses a single Universal Website Tag (the X Pixel) that can track both page views and specific events. Unlike Meta’s dual-layer architecture (Pixel + Conversions API), X Pixel is primarily browser-based. X has a Conversions API in beta/limited access, but for most advertisers the standard pixel setup is the starting point.
Step 1: Create Your X Pixel
Log in to ads.x.com. Go to Tools → Events Manager → Add Event Source → Web. Select X Pixel as the tracking method. Give your pixel a name and click Generate Code. X will produce the base pixel code with your unique pixel ID.
Step 2: Install the X Pixel on Your Shopify Store
Option A: Google Tag Manager
Create a Custom HTML tag in GTM with the X Pixel base code. Set the trigger to All Pages. This is the recommended approach if you already use GTM, as it keeps all your tags in one place.
Option B: Direct Installation
Add the X Pixel base code inside the head tag of your Shopify theme.liquid file. Place it before the closing head tag on all storefront pages.
For Checkout Pages
X Pixel must also fire on the Shopify checkout and thank-you pages to track purchases. Add the base pixel code to Shopify Settings → Checkout → Additional Scripts as well. Then add the Purchase event code specifically for the thank-you page.
Step 3: Add Standard Event Tags
X Pixel standard events for ecommerce:
ViewContent
Add to product pages: twq('event', 'ViewContent', { value: PRODUCT_PRICE, currency: 'USD', content_ids: [PRODUCT_ID] });
AddToCart
Fire on the add-to-cart action: twq('event', 'AddToCart', { value: PRODUCT_PRICE, currency: 'USD', content_ids: [PRODUCT_ID] });
Purchase
Fire on the thank-you page: twq('event', 'Purchase', { value: ORDER_TOTAL, currency: 'USD', num_items: ITEM_COUNT });
Replace PRODUCT_PRICE, PRODUCT_ID, ORDER_TOTAL, and ITEM_COUNT with actual values pulled from the Shopify dataLayer or Liquid template variables.
Step 4: Create Conversion Events in X Ads Manager
In X Ads Manager, go to Tools → Events Manager. After your pixel starts receiving events, you will see them listed. Click Create a Conversion Event to assign specific events to campaign conversion goals.
Create a conversion event for:
- Purchase: map to the Purchase event from your pixel
- Add to Cart: map to the AddToCart event (useful for retargeting campaigns)
Verifying X Pixel Events
X Ads Manager provides an Event Inspector (in Tools → Events Manager) that shows recent events received from your pixel with a 24-hour lag. To verify faster, use the browser Network tab and filter for analytics.twitter.com to see pixel requests firing in real time as you navigate your store.
X Ads Attribution
X uses a default attribution window of 1 day after a click or view. This is narrower than most other platforms. It is adjustable per campaign up to 30 days click-through. Because of the narrow default, X often appears to have lower conversion counts than Meta or Google for comparable spend, even when its actual impact may be larger.
Add UTM parameters to all X Ads campaign URLs (utm_source=twitter, utm_medium=cpc) to see X-attributed traffic and conversions in GA4 alongside other platforms.
Get Your X Ads Tracking Working
X Pixel setup is relatively straightforward but the checkout tracking step is commonly missed. If your X campaigns show clicks but zero conversions, the Purchase event is most likely not firing on the thank-you page.
Book your free Shopify tracking audit here and we will check your full X Ads pixel setup as part of a multi-platform tracking audit.