TrustData
Connectors

WooCommerce

Track orders, refunds, and cancellations from WooCommerce using native webhooks.

WooCommerce sends webhooks natively, so you write no server-side code to forward events. Install a small plugin for session matching, then register the webhooks in your WooCommerce admin.

Event mapping

WooCommerce topicWC order statusTrustData eventShopify equivalent
order.createdAny status except those listed belowpurchaseorders/paid
order.updatedAny other statusorder_updateorders/updated
order.created or order.updatedrefundedrefund (negative value)orders/updated (with refunds)
order.created or order.updatedcancelled or failed, on an order that was paidcancellation (negative value)orders/cancelled
order.created or order.updatedpending, on-hold or checkout-draftIgnoredn/a
order.created or order.updatedcancelled or failed, on an order that was never paidIgnoredn/a

TrustData treats an order as paid when WooCommerce has set its payment date. It records nothing for an ignored order and still returns 200.


Before you start

You need:

  • WordPress 6.0 or later, PHP 7.4 or later and WooCommerce 7.0 or later. This guide covers plugin version 1.0.0
  • The TrustData JS SDK installed on your storefront (see JavaScript SDK)
  • Your Attribution ID from Settings → Attribution IDs
  • Webhook receiving turned on for that attribution ID: select it, open the Receiving tab, turn on Accept incoming webhooks, and click Save receiving
  • Your property's webhook signing secret. TrustData creates it when you turn on webhook receiving, and WooCommerce signs every delivery with it

Step 1: Install the plugin

During checkout, the TrustData plugin saves the visitor ID from the browser to order meta. WooCommerce then includes it in webhook payloads, which lets TrustData match the order to the original ad click.

  1. Download trustdata-woocommerce-<version>.zip from the latest WooCommerce plugin release on the GitHub releases page
  2. In your WordPress admin, go to Plugins → Add New → Upload Plugin
  3. Select the ZIP file → click Install Now → Activate

The plugin itself has nothing to configure. It works as soon as you activate it.


Step 2: Register webhooks in WooCommerce

Go to WooCommerce → Settings → Advanced → Webhooks → Add webhook.

Create two webhooks:

Order created

FieldValue
NameTrustData Order created
StatusActive
TopicOrder created
Delivery URLhttps://t.trustdata.tech/webhooks/woocommerce/YOUR_ATTRIBUTION_ID/orders
SecretYour TrustData webhook signing secret
API versionWP REST API Integration v3

Order updated

FieldValue
NameTrustData Order updated
StatusActive
TopicOrder updated
Delivery URLhttps://t.trustdata.tech/webhooks/woocommerce/YOUR_ATTRIBUTION_ID/orders
SecretYour TrustData webhook signing secret (same as above)
API versionWP REST API Integration v3

Replace YOUR_ATTRIBUTION_ID with your Attribution ID from the TrustData dashboard.

Do not make up your own secret. TrustData checks the X-WC-Webhook-Signature header against your property's webhook signing secret and rejects any other value with 401 invalid signature. The dashboard does not display this secret yet: contact support to get it before you create the webhooks.
Both webhooks share the same endpoint URL and secret. WooCommerce sends the topic in the X-WC-Webhook-Topic header.

How session matching works

The JS SDK sets a _trdt_vid cookie when a visitor lands on your store. At checkout, the TrustData plugin reads this cookie and saves it to the WooCommerce order as _td_visitor_id meta. WooCommerce includes all order meta in the webhook payload, so TrustData receives the visitor ID alongside the order data.

Loading diagram…

Troubleshooting

Conversions not attributed

  • Confirm the TrustData plugin is active
  • Check that _trdt_vid appears in browser DevTools → Application → Cookies on your storefront
  • In WooCommerce → Webhooks, check the Delivery log for the webhook. A 200 response means TrustData received it
  • In the TrustData dashboard → Receiving tab → Recent activity, check the status. A 200 means TrustData received the order. If it is still not attributed, TrustData found no matching session

Webhook delivery failures

  • A 401 with invalid signature means the webhook Secret is not your TrustData signing secret. A 401 with no signing secret configured means webhook receiving is off for that attribution ID
  • Confirm the Delivery URL contains the correct Attribution ID
  • Check that the webhook Status is set to Active
  • WooCommerce retries failed deliveries automatically. Check the delivery log for error details