AFFYNOR's WooCommerce connector
Sync orders, catalogue and refunds from your WooCommerce store and attribute sales to your advertising campaigns (click refs and TikTok's ttclid) with automatic reconciliation.
1. Installation
1.1 Create consumer keys (Read/Write permissions)
WooCommerce → Settings → Advanced → REST API → «Add key». Permissions: read/write (registering webhooks requires write). The store must be reachable over HTTPS.
1.2 Connect from the platform
In My Store → WooCommerce card, enter the store's base URL, the consumer key and the consumer secret. The connection is validated instantly and stays active.
1.3 Install the attribution snippet
The snippet has two parts: the PHP hook (functions.php or a code snippet) that prints the order on the thank-you page, and the JavaScript (GTM or the theme) that records the reference and fires the purchase event.
add_action('woocommerce_thankyou', function ($order_id) {
if (!$order_id) return;
$order = wc_get_order($order_id);
echo '<div id="affynor-order" data-affynor-order-id="' . esc_attr($order->get_id())
. '" data-affynor-order-total="' . esc_attr($order->get_total())
. '" data-affynor-order-currency="' . esc_attr($order->get_currency()) . '" style="display:none"></div>';
}, 10);<script>
(function () {
var SITE = "https://affynor.com";
function fromUrl() {
try { return new URLSearchParams(location.search).get("affynor_ref"); } catch (e) { return null; }
}
function fromCookie(name) {
try {
var part = document.cookie.split("; ").find(function (c) { return c.indexOf(name + "=") === 0; });
return part ? decodeURIComponent(part.slice(name.length + 1)) : null;
} catch (e) { return null; }
}
var ref = fromUrl() || fromCookie("affynor_ref");
if (!ref) return;
document.cookie = "affynor_ref=" + encodeURIComponent(ref) + "; path=/; max-age=31536000; SameSite=Lax";
var fbclid = new URLSearchParams(location.search).get("fbclid") || fromCookie("affynor_fbc");
function fire(order) {
if (!order || !order.id) return;
return fetch(SITE + "/store/pixel-token?ref=" + encodeURIComponent(ref), { cache: "no-store", credentials: "omit" })
.then(function (res) { if (!res.ok) throw new Error("token unavailable"); return res.json(); })
.then(function (data) {
if (!data || !data.ok || !data.token || data.ref_code !== ref) return;
return fetch(SITE + "/store/pixel", {
method: "POST", credentials: "omit", headers: { "Content-Type": "application/json" },
body: JSON.stringify({
order_id: order.id, revenue_cents: Math.round(Number(order.total) * 100),
currency: order.currency || "EUR", ref_code: ref, fbclid: fbclid, token: data.token
})
});
}).catch(function () {});
}
window.affynorPixel = fire;
setTimeout(function () {
var e = document.getElementById("affynor-order");
if (e) fire({
id: e.getAttribute("data-affynor-order-id"),
total: e.getAttribute("data-affynor-order-total") || "0",
currency: e.getAttribute("data-affynor-order-currency") || "EUR"
});
}, 400);
})();
</script>The browser requests a temporary signed token via GET /store/pixel-token Never put a server secret in JavaScript.
2. Attribution
The affynor_ref parameter in the ad URL (or TikTok's ttclid) is stored in a cookie and attached to the order on the thank-you page. The snippet also stores Meta's fbclid — in the fb.1.<timestamp>.<fbclid> format — so that the conversion can be matched to the click on Meta. The event stays pending and is reconciled automatically against the synced orders: only verified sales are attributed to your campaigns.
3. Synchronisation
WooCommerce webhooks (order.created, order.updated, product.created, product.updated) deliver changes in real time; a safety sync walks the store every 10 minutes — including refunds via GET /orders/{id}/refunds — so that no order goes unrecorded even if WordPress's cron fails.
4. Refunds
Refunds are synced automatically and subtracted from the month's attributed revenue. A fully refunded order is rejected during reconciliation: it never generates commission.
5. Fee model
15% of the month's attributed revenue, with a minimum of €129.90. If the month has no attributed sales, the minimum does not apply (month 1 is free). The minimum is per merchant even with several connected stores (for example Shopify + WooCommerce).
6. Troubleshooting
The merchant's WordPress cron is disabled or delayed
Check the cron in WP; meanwhile the safety sync (every 10 minutes) covers orders. Documented in the FAQ.The signature variant (body versus delivery_url+body) or the consumer secret do not match
Recompute the HMAC with the current consumer secret and recreate the webhook with that secret.Consumer key revoked or without read/write permission
Regenerate the key in WooCommerce and reconnect from the card.The snippet did not fire (adblock, cookie, page other than the thank-you page)
Check the snippet on the thank-you page; the event stays PENDING until the sync reconciles it.7. Status and roadmap
The connector is in validation with pilot merchants: connection, attribution and sync are complete (Phases A–D); validation in real stores (Phase E) is under way. Publishing it as an extension in the WooCommerce marketplace is the next milestone.
Need help with an integration?
Get assistance with connection requirements, setup or tracking questions.
Private beta. Visible boundaries. AFFYNOR is in private beta. Programme permissions, markets and traffic methods must be reviewed individually. Customer funding remains disabled. Read our compliance framework