TrustData
Connectors

WooCommerce

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

WooCommerce natively sends webhooks — no custom server-side code is needed to forward events. You only need a small plugin to enable session matching, then register the webhooks in your WooCommerce admin.

Event mapping

WooCommerce topicWC order statusTrustData eventShopify equivalent
order.createdprocessing, completedpurchaseorders/paid
order.updatedrefundedrefundorders/updated (with refunds)
order.updatedcancelled, failedrefundorders/cancelled

Before you start

You need:

  • The TrustData JS SDK installed on your storefront (see JavaScript SDK)
  • Your Attribution ID from SettingsAttribution IDs

Step 1 — Install the plugin

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

  1. Download trustdata-woocommerce.zip from the GitHub releases
  2. In your WordPress admin, go to PluginsAdd NewUpload Plugin
  3. Select the ZIP file → click Install NowActivate

No configuration needed — the plugin works automatically once activated.


Step 2 — Register webhooks in WooCommerce

Go to WooCommerceSettingsAdvancedWebhooksAdd webhook.

Create two webhooks:

Order created

FieldValue
NameTrustData – Order created
StatusActive
TopicOrder created
Delivery URLhttps://t.trustdata.tech/webhooks/woocommerce/YOUR_ATTRIBUTION_ID/orders
SecretGenerate a random string and copy it
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
SecretSame secret as above
API versionWP REST API Integration v3

Replace YOUR_ATTRIBUTION_ID with your actual Attribution ID from the TrustData dashboard.

Both webhooks share the same endpoint URL and secret. The topic is sent automatically by WooCommerce 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 site. 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.

Visitor lands on store             → JS SDK sets _trdt_vid cookie
Visitor completes checkout         → Plugin saves _trdt_vid to order meta
WooCommerce fires order.created    → Sends webhook to TrustData
TrustData reads _td_visitor_id     → Matches order to ad session

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 → Webhooks tab → Recent Activity, check session_matchedfalse means the webhook arrived but no session was found

Webhook delivery failures

  • 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