WooCommerce Integration

WooCommerce Creator Ad Attribution

Connect Castlytics to your WooCommerce store and automatically match coupon codes, tracking links, and order data to your creator ad campaigns.

Install the WordPress plugin in 60 seconds — or connect via the REST API for more control.

🔌

Official WordPress plugin — easiest setup

Free

Install the plugin from the WordPress directory, enter your Castlytics Site Key, and you're done. The plugin automatically injects the tracking snippet on all pages and sends every completed order to Castlytics — no REST API credentials, no webhook configuration, no code.

✅ Auto-injects tracking snippet✅ Sends orders on completion✅ Matches promo codes to campaigns✅ Works with HPOS (WooCommerce 8+)
Install plugin →WordPress.org plugin directory

What the WooCommerce integration does

Three automated data flows that connect your WooCommerce store to Castlytics attribution.

🎟️

Coupon code tracking

Each creator campaign gets a unique coupon code. When a WooCommerce order uses that code, the conversion is automatically attributed to the campaign. No manual matching needed.

🔗

Order webhook sync

WooCommerce sends order data to Castlytics via webhook the moment an order is placed. Revenue, coupon code, and order status are synced in real time to your dashboard.

📊

Campaign-level ROAS

See revenue generated per campaign, per creator, and per channel. ROAS is calculated automatically as orders flow in — no spreadsheets, no manual calculations.

How the WooCommerce integration works

WooCommerce REST API plus order webhooks — no plugin, no custom PHP, no modifications to your store files.

01

WooCommerce REST API authentication

Consumer key + consumer secret — read-only access

Generate a read-only API key in WooCommerce Settings → Advanced → REST API. Enter the consumer key and secret in your Castlytics integration settings. Castlytics only requests read access — it never modifies orders or products.

Read-only WooCommerce API access — no write permissions required

02

Order webhook fires on each purchase

woocommerce_order_status_completed → Castlytics endpoint

Castlytics registers a webhook for the order.completed event. When a WooCommerce order completes, the full order object — including coupon codes, line items, and order total — is sent to Castlytics automatically.

Webhook registered programmatically via WooCommerce REST API — no manual setup

03

Coupon code matched to campaign

Order coupon_lines[].code compared to active campaign codes

Castlytics compares the order's coupon code to all active campaign promo codes. A match triggers a conversion event: the order total is attributed to the campaign and your ROAS dashboard updates in real time.

Conversion window is respected — orders outside the window are not attributed

Two ways to connect

Choose whichever fits your workflow.

Option A — RecommendedWordPress Plugin2 steps · 60 seconds
1

Install the plugin from WordPress.org

Search "Castlytics" in WordPress → Plugins → Add New, or download directly from the WordPress plugin directory. Activate it.

2

Enter your Site Key under Settings → Castlytics

Find your Site Key in your Castlytics dashboard under Settings → Developer API. Paste it in and click Save. The tracking snippet is injected and order tracking is live immediately.

or
Option BManual REST API setup4 steps · more control
1

Add the tracker script to your WordPress site

Add the Castlytics script to your WordPress theme's header. Use a header plugin or add it to your theme's header.php file.

<script src="https://castlytics.app/tracker.js" data-key="YOUR_KEY" async></script>
2

Generate a WooCommerce REST API key

In WooCommerce, go to Settings → Advanced → REST API → Add Key. Set permissions to Read Only. Copy the consumer key and consumer secret.

3

Enter your API credentials in Castlytics

In your Castlytics dashboard, go to Integrations → WooCommerce. Enter your store URL, consumer key, and consumer secret.

// Castlytics WooCommerce config
{
  storeUrl: "https://yourstore.com",
  consumerKey: "ck_xxxxxxxxxxxx",
  consumerSecret: "cs_xxxxxxxxxxxx"
}
4

Create campaigns with coupon codes

Create a campaign in Castlytics for each creator and set the promo code. Ensure the same coupon code exists in WooCommerce Coupons. Place a test order to verify the integration.

WooCommerce integration questions

How does the Castlytics WooCommerce integration work?

Castlytics connects via the WooCommerce REST API and order webhooks. When an order is placed, WooCommerce sends the order data to Castlytics. We match the coupon code against your active campaign promo codes and record the conversion automatically.

Is there a WordPress plugin I can install?

Yes — the official Castlytics for WooCommerce plugin is available on the WordPress plugin directory. Install it, enter your Site Key under Settings → Castlytics, and tracking is live in under a minute. No REST API credentials or webhook setup needed.

What WooCommerce data does Castlytics access?

Castlytics receives order total, coupon code used, order status, and a hashed customer email for LTV tracking. We use read-only access and do not store full customer names, addresses, or payment information.

Can I track percentage-off coupons as well as fixed-amount coupons?

Yes. Castlytics matches any coupon code type in WooCommerce — fixed cart, percentage, fixed product, or free shipping. The code string is matched regardless of discount type.

What if my WooCommerce store cannot send outbound webhooks?

If your store is behind a firewall that blocks outbound webhooks, Castlytics can use a polling fallback: we query your WooCommerce REST API every 15 minutes to pull new orders. Your REST API must be accessible from our servers.

Connect your WooCommerce store today

Free plan includes 3 campaigns, unlimited clicks, and 30-day attribution. No credit card required.

Create free account →