Follow me on X. @sangngqang

Pixel (tracking pixel)

A pixel is a small piece of code on your website that tells ad platforms like Meta or TikTok what visitors do, such as viewing products or buying.

What is a pixel?

A tracking pixel is a snippet of code from an ad platform, such as the Meta Pixel or TikTok Pixel, that you add to your store. When someone visits a page, adds to cart or completes a purchase, the pixel sends that event back to the platform. The name comes from early tracking methods that used a tiny invisible image, but today it is usually a script. Pixels matter because ad platforms use these events to measure results, build retargeting audiences and decide who to show ads to next. Without good pixel data, the platform cannot tell which ads lead to sales, and campaigns that optimise for purchases have little to learn from.

How a pixel works

You create a pixel in the ad platform, then install it on your store, often through a built-in integration such as Shopify’s sales channel apps. The pixel loads on every page and fires standard events at key moments: page view, view content on a product page, add to cart, initiate checkout and purchase, often with the order value. For example, a shopper clicks a Meta ad, views a hoodie and buys it for 60 dollars. The pixel reports the product view and a purchase worth 60 dollars, and Meta matches that to the ad click. Many stores also send the same events server to server, such as through Meta’s Conversions API, to fill gaps from browser blocking.

When to use it

Install the pixel for every ad platform you plan to use before you start spending, so it can collect data from the first visitor. It powers conversion tracking, retargeting audiences, lookalike audiences and purchase-optimised campaigns. The pros are better measurement and smarter delivery. The cons are that browser privacy features, ad blockers and phone-level tracking limits mean the pixel misses some events, so reported numbers are often lower than real sales. Pixels also raise privacy duties: in many regions you must show a cookie notice and get consent before tracking. Pairing the pixel with server-side events and consent tools helps on both fronts.

Best practices

Use your store platform’s official integration rather than pasting code by hand when you can, since it usually sets up standard events correctly. Check events with the platform’s testing tools after installing, and place a test order to confirm the purchase event fires once with the right value and currency. Add server-side events, such as the Conversions API, with deduplication so purchases are not counted twice. Avoid installing the same pixel twice through different apps. Respect consent rules in each region. Verify your domain in the ad platform and prioritise the events that matter most, typically purchase, so optimisation has the cleanest signal.

Pixel vs Conversions API

A pixel tracks events from the shopper’s browser. The Conversions API, and similar server-side tools from other platforms, sends events from your store’s server directly to the ad platform. Browser tracking can be blocked by ad blockers, privacy settings and short cookie lifetimes, so the pixel alone often misses conversions. Server events are not affected by those browser limits. The best practice is to use both together and let the platform deduplicate matching events with a shared event ID, so you get fuller data without double counting. This combined setup is now the standard for most stores running paid ads.

Read the guide: How to see what apps a Shopify store uses (free)

Questions

Why does my pixel show fewer sales than my store?
Browser privacy features, ad blockers and phone tracking limits stop some events from reaching the platform. Adding server-side tracking, such as Meta’s Conversions API, usually closes much of that gap.
Do I need a separate pixel for each ad platform?
Yes. Each platform, such as Meta, TikTok, Google or Pinterest, has its own tag or pixel, because each one needs its own data to measure ads and optimise delivery.

Related terms