Last updated Anacoic team Checked against the product on

WooCommerce server-side tracking without Google Tag Manager

You can send WooCommerce purchases server-side without Google Tag Manager in three ways: a WordPress plugin that calls Meta’s Conversions API, your own code, or a gateway that takes one event and sends it on. Whichever you choose, send each purchase from the order itself once it’s paid, use the same event ID as the browser pixel, and pass the customer’s details and IP address from the order. Then check that Meta received as many purchases as WooCommerce took orders.

Key takeaways

  • WooCommerce fires woocommerce_payment_complete when a payment completes. That’s the moment to send the server copy of a purchase.
  • Use one event ID per order, such as order_10482, in the browser and on the server, so Meta counts each purchase once.
  • A server request comes from your web server, so send the buyer’s IP address and browser user agent from the order. Otherwise the platform sees your server’s.
  • Bank transfer and cash on delivery orders don’t complete payment at checkout. Decide whether they count as purchases.
  • Check the result against your WooCommerce orders, day by day.

What are the ways to do it without GTM?

Three routes, each with a different amount of code and upkeep.

RouteHow it worksFits when
A Conversions API pluginA WordPress plugin sends purchases from your site to Meta, using a token you paste inYou want no code and use Meta only
Your own codeYour theme or a small plugin calls Meta’s Conversions API on each paid orderYou have a developer and one ad platform
A gatewayThe ana.js tracker and a small order hook send events to a gateway, which sends them on to each platform and logs the repliesYou want one place for several platforms and a delivery log, without a tag server

All three send events from a server. None of them needs server-side Google Tag Manager. The rest of this guide shows the gateway route, with code you can adapt for the other two.

How do I send WooCommerce purchases through a gateway?

Add the tracker for browser events, then add one hook that sends each paid order from your server.

1. Create a gateway and connect Meta

Create a gateway in the app and add Meta’s Conversions API as a destination. The gateway quickstart covers both. Meta’s Conversions API works today; Google Ads is on request, and other platforms are in beta.

2. Add the tracker to the site

Add the ana.js tracker to your theme’s header, with a plugin such as WPCode, or in your child theme. WordPress and WooCommerce: gateway setup shows each method, and the thank-you page snippet that sends Purchase from the browser with event_id: 'order_<order id>'.

<script src="https://edge.anacoic.com/v1/ana.js"
        data-gateway="YOUR_GATEWAY_ID"
        data-emq="optimize"
        data-enrich="true"></script>

data-emq="optimize" sends the page URL with each event, and data-enrich="true" adds a signed-in customer’s email and ID when the page shows them (API reference).

3. Send each paid order from the server

Add this to a small custom plugin or your child theme’s functions.php. It runs when WooCommerce marks a payment complete, and sends the order to the gateway with the same event ID the thank-you page uses.

<?php
// Anacoic: send each paid WooCommerce order server-side, with the same event ID as the browser
add_action( 'woocommerce_payment_complete', 'anacoic_send_paid_order', 10, 1 );

function anacoic_send_paid_order( $order_id ) {
    $order = wc_get_order( $order_id );
    if ( ! $order ) {
        return;
    }

    // Orders created in the admin have no buyer IP; the gateway would see your server's instead
    $ip = $order->get_customer_ip_address();
    if ( ! $ip ) {
        return;
    }

    $event = array(
        'event_name' => 'Purchase',
        'event_id'   => 'order_' . $order->get_id(), // the same ID as the thank-you page event
        'timestamp'  => $order->get_date_paid() ? $order->get_date_paid()->getTimestamp() : time(),
        'user'       => array(
            'email'             => $order->get_billing_email(), // hashed by the gateway
            'phone'             => $order->get_billing_phone(), // send it with the country code (+44...)
            'external_id'       => (string) $order->get_customer_id(),
            'client_ip_address' => $ip,
            'client_user_agent' => $order->get_customer_user_agent(),
            'event_source_url'  => $order->get_checkout_order_received_url(),
        ),
        'custom_data' => array(
            'value'          => (float) $order->get_total(),
            'currency'       => $order->get_currency(),
            'transaction_id' => (string) $order->get_order_number(),
        ),
    );

    $response = wp_remote_post( 'https://edge.anacoic.com/track', array(
        'timeout' => 5,
        'headers' => array(
            'Content-Type' => 'application/json',
            'X-Gateway-ID' => 'YOUR_GATEWAY_ID',
        ),
        'body'    => wp_json_encode( $event ),
    ) );

    if ( is_wp_error( $response ) ) {
        wc_get_logger()->warning( 'Anacoic: ' . $response->get_error_message(), array( 'source' => 'anacoic' ) );
    }
}

What each part does:

  • woocommerce_payment_complete is the action WooCommerce fires after WC_Order::payment_complete() saves a paid order (WooCommerce source: class-wc-order.php, checked 28 November 2026).
  • The order methods (get_customer_ip_address, get_customer_user_agent, get_billing_email and the rest) are listed in the WooCommerce code reference for WC_Order.
  • wp_remote_post is WordPress’s own HTTP function (WordPress developer reference).
  • The user fields are the ones the gateway reads; it hashes email, phone and the customer ID with SHA-256 before sending them on (API reference).
  • event_source_url gives Meta the page the purchase happened on. If you turn on domain locking for the gateway, it also tells the gateway the request belongs to your store, since a server request carries no browser origin.

The same customer ID can be 0 for guest checkouts. You can drop external_id for those.

4. Let the gateway send each order once

The browser event and the server event carry the same ID, so the gateway sends whichever arrives first and skips the other: it ignores a repeat of an event ID it has received in the last 24 hours. Meta gets the order once.

If a separate Meta pixel plugin also sends Purchase from the browser, give it the same event ID, order_<order id>, or turn off its purchase event. Meta pairs a pixel event and a server event only when the event ID and event name match, within 48 hours (Meta for Developers: deduplication). Meta shows more purchases than Shopify covers what goes wrong when they don’t; the causes are the same on WooCommerce.

What about bank transfer and cash on delivery?

They don’t fire woocommerce_payment_complete at checkout. For an order with a total above zero, WooCommerce’s built-in bank transfer method sets the order to on-hold instead, and calls payment_complete() only for zero-total orders (WooCommerce source: the bank transfer gateway, checked 28 November 2026).

Decide what a purchase means for your store, then count the same thing everywhere:

  • Count only paid orders. Keep the hook above. When you later mark a bank transfer order as paid, WooCommerce changes its status, which fires woocommerce_order_status_<status> (class-wc-order.php). Hook woocommerce_order_status_processing too if you want those orders. An order that fires both hooks carries the same event ID, so the gateway still sends it once within 24 hours. Also wrap the thank-you page snippet in if ( $order->is_paid() ), so an unpaid order isn’t sent from the browser days before it’s paid.
  • Count every placed order. Send from the thank-you page and accept that some will never be paid.

Whatever you choose, count the same orders in WooCommerce when you compare.

Are there limits to know about?

Two, both from the gateway.

  • Requests per IP. The gateway limits each sending IP address to 30 requests a minute, on every plan (API reference: rate limits). Your server sends from one address, so that’s 30 paid orders a minute from the hook. If your store can go above that at peak, talk to us before you rely on it.
  • Signals per month. The free plan includes 10,000 signals a month and pauses forwarding at the limit. One signal is one request that reaches at least one destination (signals explained).

How do I check it’s working?

Run the three checks from server-side tracking: how to check it worked: sent, accepted, counted against your orders.

  1. Place a test order and pay it. In Meta Events Manager, Test Events shows the purchase arriving (Meta for Developers: using the API).
  2. Read the delivery log in the app: one Purchase with Meta’s reply. The second copy of the same event ID is logged as a duplicate and not sent on.
  3. Check WooCommerce’s log (WooCommerce → Status → Logs, source anacoic) for any request the hook couldn’t send.
  4. Compare with your orders each day. Divide the Purchase events Meta received by that day’s paid WooCommerce orders. A drop means events went missing; a share above 100% means duplicates.

Watch, in early access, does step 4 for you. It reads your WooCommerce orders through two built-in WooCommerce webhooks, with nothing to install, and compares each finished day with the Purchase events Meta received (connect WooCommerce to Watch).

What this can’t tell you

  • How many purchases you’ll recover. It depends on your visitors and checkout. Measure the share of orders Meta receives before and after.
  • Whether your payment plugin calls payment_complete(). Payment plugins are meant to; test one paid order with each payment method you offer.
  • Whether your consent setup allows sending. Server-side delivery follows the same consent rules as a pixel; your consent banner decides.

Next step

Scan your site's tracking setup for free and see what a scan can and can't tell you. No account needed.