Guide · Tracking and data

Ecommerce ad tracking: the complete guide for Meta, Google and TikTok

How ad tracking works for a webshop: pixels, server events, Meta, TikTok and Google Ads setup, why numbers differ from your shop, and how to fix it.

Updated · 13 min read

By the ROASaurus team

The short answer
  • Ecommerce ad tracking tells each ad platform which clicks led to which orders, so it can report results and bid on the shoppers who buy.
  • A browser pixel alone misses orders: ad blockers, privacy settings, consent and closed tabs stop it. Send the paid order from your server as well, with the same event id.
  • Meta, TikTok and Google Ads each need their own pixel or tag and their own server connection; Google Tag Manager or an app can place them for you.
  • When the platform reports fewer orders than your shop, check for missing events, duplicates, wrong values and consent loss, in that order.
  • Tracking is never finished: compare platform orders with shop orders every week and check failed server events.

Every ad platform learns from the orders you report back to it. Meta, Google Ads and TikTok use those reports twice: to show you which campaigns worked, and to decide whom to show your ads to next. When orders go missing, the reports undercount and the bidding learns from a smaller, skewed sample of your buyers.

This guide explains how ecommerce ad tracking works, how to set up conversion tracking for Meta, TikTok and Google Ads, which numbers to watch, why the platforms rarely agree with your shop, and how to find and fix the gaps. Each platform has its own detailed guide on this site; this one shows how the pieces fit together.

What ecommerce ad tracking is

Ad tracking connects two events that happen in different places: a click on an ad, and an order in your shop. The ad platform knows about the click. Your shop knows about the order. Tracking passes the order back to the platform with enough information to match it to the click.

Ad clickThe platform adds a click id to the landing page address (fbclid, gclid, ttclid).
VisitA pixel or script stores the click id in a first-party cookie.
OrderThe shopper pays. The shop creates the order.
ConversionThe pixel and the server send a purchase with the click id, value and hashed customer details.
Match and learnThe platform matches the purchase to the click and credits the ad.
Tracking is the chain from click to order. A break anywhere in it means the platform never sees the sale.

Two kinds of tools carry the order back:

  • Conversion pixels (the Meta pixel, the TikTok pixel, the Google tag) are scripts that run in the shopper's browser. They read the platform's cookies and send events such as page views, adds to cart and purchases.
  • Server-side connections (Meta's Conversions API, TikTok's Events API, Google Ads' offline and enhanced conversions) send the same events from a server. They do not depend on the shopper's browser, so they still arrive when a pixel is blocked. Our explainer on server-side tracking covers the idea.

How a conversion pixel works

A conversion pixel is a small script from the ad platform. Once it is on your pages, it does three things:

  1. It identifies the visitor

    On the first visit it sets a browser cookie (for Meta, _fbp; for Google Ads, _gcl_aw when the visitor came from an ad) and keeps the click id from the landing page.

  2. It records events

    Standard events describe what the shopper did: a page view, a product view, an add to cart, a started checkout, a purchase. Each event can carry a value, a currency, product ids and an order id.

  3. It sends them to the platform

    The platform matches each event to a person or a click, counts conversions for your campaigns, and builds audiences such as "viewed a product in the last 14 days".

The purchase is the event that matters most, because campaigns optimise towards it and ROAS is calculated from its value. The other events help the platform learn earlier in the funnel and feed remarketing audiences.

The numbers ad tracking feeds

Ad tracking is not a goal in itself. It exists so that you can read these numbers and act on them:

NumberWhat it tells youWhat it needs from tracking
Conversions (purchases)How many orders the platform credits to its adsEvery paid order, once
Conversion value and ROASRevenue per euro of ad spendThe right value per order, in the right currency, without tax and shipping if you choose so
Cost per acquisition (CPA)What one order costs in adsThe same complete order count
New customer shareWhether ads bring new buyers or reach existing onesA new or returning flag per order
Add-to-cart and checkout ratesWhere shoppers drop out after the clickFunnel events with the same visitor id
Profit per campaign (POAS)Whether the orders made money after costsOrder ids that can be joined to costs
Every number on this list is wrong by the share of orders the tracking misses or double counts.

Swipe the table sideways to see every column.

For the definitions, see ROAS, CPA and POAS.

Setting up conversion tracking on each platform

The order of work is the same everywhere: create the pixel or tag in the ad platform, install it on the shop, send the standard events with the right parameters, add a server connection, and test. The details differ per platform.

Meta (Facebook and Instagram)

In Meta Events Manager, create a dataset (Meta's newer name for a pixel) and note its id. On Shopify, the Facebook & Instagram app can install the pixel and, at its higher data sharing levels, the Conversions API. A tracking app or your own server can send the Conversions API instead. Verify your domain in Business Manager, then test with the Test events tab. The full walk-through is in Meta pixel and Conversions API on Shopify.

TikTok

In TikTok Ads Manager, open Events and create a web pixel. TikTok's Shopify app can install it, or you can add the base code to your theme or through Google Tag Manager. Send ViewContent, AddToCart, InitiateCheckout and CompletePayment (TikTok's purchase event), and connect the Events API so purchases also arrive from a server. TikTok's Pixel Helper browser extension shows which events fire. Our post on the TikTok Events API on Shopify covers the server side.

Google Ads

In Google Ads, create a purchase conversion action under Goals › Conversions, choose to count every conversion, and use the order value. Install the Google tag on all pages and fire the conversion event with the order id and value on the order confirmation. On Shopify, the Google & YouTube app sets this up for you; a tracking app or Google Tag Manager are the alternatives. Turn on enhanced conversions so hashed customer details help match orders. Details are in Google Ads conversion tracking on Shopify.

Through Google Tag Manager

Google Tag Manager (GTM) is a container that loads other tags. Instead of pasting each pixel into the theme, you add GTM once and configure the Meta, TikTok and Google tags inside it, triggered by events that your shop pushes into a data layer. It keeps tags in one place, but it needs a data layer with the right values, and on Shopify's checkout it runs inside a sandbox with limits. See Google Tag Manager on Shopify.

Why the platforms report different numbers from your shop

Almost every store sees the ad platforms disagree with the shop. Some of the difference is normal: the platforms attribute an order to the ad within their own window (Meta by default within 7 days of a click or 1 day of a view), they count by click date or impression date, and they credit the same order to more than one platform. Our post on why Ads Manager and Shopify disagree explains the attribution side.

The rest is tracking loss or tracking error. The worked example shows how to tell them apart.

One week of orders, ROASaurus Demo StoreSample data

The fictional store compares shop orders with what each platform received, before any attribution.

Paid orders in the shop400
Orders from visitors who clicked a Meta ad150
Purchase events Meta received (browser pixel only)108
Share of Meta-clicked orders Meta saw72%
Purchase events Meta received after adding server events147
Share Meta saw with server events98%
Example data for a fictional store. The three missing orders came from visitors who declined marketing cookies and had no click id, so they could not be matched to an ad.

How to fix common tracking issues, step by step

  1. Count orders on both sides

    Take one week. Count paid orders in your shop and purchase events received in each platform's event overview (not the attributed conversions in campaign reports). The gap per platform is your starting point.

  2. Look for duplicates first

    If a platform receives more purchases than you had orders, the pixel is installed twice or the browser and server events do not share an event id. Fix this before anything else, or every later number is inflated.

  3. Check the values

    Compare the value of a few test orders with what the platform received: currency, tax, shipping and discounts. A wrong currency or a value in cents breaks ROAS even when the count is right.

  4. Find the missing events

    Test a full order with an ad blocker on, in Safari, and with marketing cookies declined. The orders that disappear show which route is failing.

  5. Add the server route

    Send each paid order from the server with the same event id as the browser event. This recovers orders the browser missed without counting them twice.

  6. Improve matching

    Pass hashed email and phone, the click id, IP address and user agent with each server event, so the platform can tie it to the click.

Common setup mistakes

These mistakes come up again and again, on Google Ads more than anywhere else:

  • Two purchase actions both set as primary. Google Ads counts both, so each order shows twice in the Conversions column and Smart Bidding chases inflated numbers. Keep one primary purchase action; set others as secondary.
  • Counting "one" instead of "every". For purchases, every order is a conversion. "One" is for leads.
  • A fixed value or no value. Without the real order value, Target ROAS has nothing to aim at.
  • GA4 conversions imported next to the Google Ads tag. Importing GA4 purchases as primary alongside the tag doubles the count. Use one as primary.
  • No order id. The transaction id lets Google drop a duplicate when the thank-you page is reloaded.
  • Purchase fired on page load of the thank-you page only. Shoppers who close the tab before it loads are lost. The server route covers them.
  • Old code left behind. Pixel snippets in the theme or in Shopify's old additional scripts keep firing next to the new setup.
  • Test orders left in. Test orders and staff orders inflate conversions; exclude them or delete them from the platform where it allows.

Our post on Google Ads conversion tracking problems goes deeper into the Google side, and multiple Meta pixels on Shopify into the Meta side.

What reliable ad tracking needs beyond the pixel

A pixel on every page is the starting point. A setup that holds up under ad blockers, Safari's cookie limits and consent banners adds these parts:

PartWhat it solvesHow
Server eventsOrders the browser never reportsSend the paid order from the shop's order data to each platform's server API
One event id per orderDouble counting between browser and serverBoth copies of a purchase carry the same id, for example order- plus the order id
First-party click captureClick ids lost when third-party scripts are blockedRead fbclid, gclid and ttclid on your own domain and store them with the visitor
Click id on the orderOrders that cannot be tied to a visitSave the visitor id and click ids on the cart, so they arrive with the order
Hashed customer detailsLow match ratesNormalise and SHA-256 hash email, phone and address before sending
Consent handlingTracking people who said no, or losing everyoneRead the visitor's choice and send only what it allows
MonitoringTracking that breaks silentlyCompare platform events with shop orders daily and log every failed send

Swipe the table sideways to see every column.

Our guides to server-side tracking on Shopify, duplicate purchase events and Consent Mode v2 cover these parts in depth.

Data layers, GTM containers and validation

Many tracking setups on Shopify are built around three tools. It helps to know what each does, whichever route you take.

  • A data layer is a JavaScript list, window.dataLayer, into which the shop pushes structured events: "product viewed, id 123, price 40". Tags read from it instead of scraping the page. A good data layer is accurate on add to cart and remove from cart, carries product, variant and price data, and runs without slowing the page. See the Shopify data layer.
  • A GTM container holds the tags, triggers and variables for each platform. Prepared containers save setup time, but every tag in them is one more script on your pages and one more thing to keep current when a platform changes its events.
  • Validation checks that events arrive: in the browser with each platform's helper extension, in the platform's test views, and over time by comparing the platform's event counts with your orders. Automated checks catch the breaks that a one-off test misses.

Troubleshooting pixel issues

When a pixel misbehaves, find the symptom in the table, then confirm the cause with the platform's own tool: Meta Pixel Helper and Test events, TikTok Pixel Helper and Test events, Google Tag Assistant and the Google Ads conversion diagnostics.

SymptomLikely causeFix
No events at allPixel not installed, wrong id, or blocked until consentCheck the id in the page source or the helper extension; test with consent given
Purchases but no page viewsPixel only on the thank-you pageLoad the base code on every page
Twice as many purchases as ordersTwo senders for the same pixel, or no shared event idRemove one sender; give browser and server the same event id
Purchases without valueValue parameter missing or sent as textSend value as a number and a three-letter currency code
Events arrive, but campaigns show few conversionsLow match rate or events outside the attribution windowAdd hashed email and phone, click ids, IP address and user agent
Pixel shows events in a test, none in productionA test code left in, or a test version of the tag publishedRemove the test code and publish the live version
Sudden drop on one dateTheme change, new checkout, app removed, expired tokenCheck what changed that day; renew the server token

Swipe the table sideways to see every column.

Keep checking after setup

Tracking breaks without warning: a theme update removes a snippet, an access token expires, a new app adds a second pixel, a consent banner starts blocking everything. Put three checks in your week:

  • Purchase events received per platform against paid orders in the shop, for the same days.
  • Failed or rejected server events, with the platform's error message.
  • Event match quality (Meta) or enhanced conversions coverage (Google Ads), against last month.
  • Before a big sale, a full test order on each platform. Our BFCM tracking checklist lists what to check.

The free tracking audit checks a store's pages for the pixels and tags it loads.

How ad tracking works in ROASaurus

ROASaurus sends each paid order server-side to 16 ad platforms, including Meta, Google Ads and TikTok, from the shop's order data. On Shopify, installing the ROASaurus Shopify app registers the order webhooks and the checkout pixel; the storefront script captures click ids and UTM tags first-party, through the Shopify app proxy on your own domain, and writes the visitor id to the cart so it arrives with the order. Browser pixels are optional and share one event id with the server events (order- plus the order id for a purchase), so each platform keeps one copy. The server sends the purchase 20 seconds after payment.

In ROASaurusConnections › Tracking & destinations
  1. Install the tracking: on Shopify, install the ROASaurus Shopify app; on other shops, paste the script and connect the order webhook.
  2. Add a destination per ad platform: for Meta, connect with Facebook or paste the dataset id and a Conversions API token; for Google Ads, the conversion id and purchase label; for TikTok, the pixel code and an Events API token.
  3. Tick "Also load the browser pixel" where you want the pixel next to the server events; both share one event id.
  4. Open Data quality › Overview to see, per platform, how many orders were expected and accepted, the match keys sent and Meta's event match quality.
  5. Open Data quality › Deliveries to see each server event with its status (queued, sent, skipped, failed), the reason and the platform's answer; failed events can be sent again.
The ROASaurus Mac app showing Deliveries: each server event per platform with its status and the platform's answer. Fictional demo store, simulated data.
The ROASaurus iPhone app showing Deliveries: each server event per platform with its status and the platform's answer. Fictional demo store, simulated data.
Data quality › Deliveries: each server event per platform with its status and the platform's answer. Fictional demo store, simulated data.

ROASaurus is in production use for Meta and Google Ads today. The other destinations are built from each platform's documentation and have not carried a customer's traffic yet.

Start freeOpen the live demo14-day trial of every feature, no credit card.

The ROASaurus Mac app showing Tracking health: a card per destination, Purchase accuracy per day for Meta, GA4 and TikTok, and accuracy per payment method. Fictional demo store, simulated data.
The ROASaurus iPhone app showing Tracking health: a card per destination, Purchase accuracy per day for Meta, GA4 and TikTok, and accuracy per payment method. Fictional demo store, simulated data.
Data quality › Overview: accuracy per ad platform, missed orders and match keys. Fictional demo store, simulated data.

Sources

  1. Meta for Developers: Conversions API
  2. Meta for Developers: Handling duplicate pixel and Conversions API events
  3. Google Ads Help: Set up conversion tracking with the Google & YouTube app on Shopify
  4. Google Ads Help: About enhanced conversions
  5. Google Ads Help: About primary and secondary conversion actions
  6. TikTok Business Help: About Events API
  7. Shopify Dev: Web pixels API standard events

More guides on tracking and data · All guides

FAQ

Questions, answered

More answers in the FAQ and the help center.

What is ecommerce ad tracking?

It is the setup that reports a webshop's orders back to the ad platforms, matched to the ad clicks that led to them. Platforms use it to report results and to decide whom to show ads to.

How do I install a Meta pixel for conversion tracking?

Create a dataset in Meta Events Manager, install it on every page (on Shopify through the Facebook & Instagram app, a tracking app or Google Tag Manager), send standard events such as AddToCart and Purchase with value and currency, and check them in Test events. Add the Conversions API so purchases also arrive from a server.

How do I add a TikTok pixel to Shopify?

Create a web pixel under Events in TikTok Ads Manager, then install it with TikTok's Shopify app, a tracking app or Google Tag Manager. Send CompletePayment for purchases and connect the Events API for server-side events.

Can I add a TikTok pixel through Google Tag Manager?

Yes. Add TikTok's base code as a tag that fires on all pages and separate event tags triggered by data layer events. On Shopify's checkout, GTM runs inside a custom pixel sandbox with its own limits.

Why does my TikTok pixel not show events in reports?

Usually the pixel id is wrong, the pixel waits for consent that is never given, events are sent with the wrong name, or the pixel is still in test mode. Check with TikTok Pixel Helper and the Test events view in Events Manager.

How do I create a conversion action in Google Ads?

In Google Ads, open Goals › Conversions, add a website conversion action for purchases, count every conversion, use the transaction value, and install the tag or connect it through the Google & YouTube app on Shopify.

Why do my ad platforms report more orders than my shop?

Each platform credits every order its ads touched within its attribution window, so the same order can count on several platforms. Double-installed pixels and browser and server events without a shared event id inflate it further.

Do I still need a pixel with server-side tracking?

The platforms recommend both: the pixel adds browser signals such as cookies, and the server delivers what the browser misses. Give both copies of an event the same event id so it counts once.

What do I need before I start?

Admin access to your shop and to each ad account, the pixel or dataset ids, a server API token per platform, a cookie consent banner if you sell in the EU, and a few test orders you can place and cancel.

Every sale, traced to the ad that earned it

Server-side tracking, profit and lifetime value in one app. Free plan, no credit card.