Skip to main content

Guide · Awin

Awin advertiser conversion sync with TrackLayer

This guide covers the exact Awin server-side conversion flow: capture awc at landing, authenticate with an advertiser API token, and send purchase records to the advertiser conversions endpoint with clean order references and predictable retry behavior.

Endpoint

https://api.awin.com/advertisers/{advertiser_id}/conversions

Click id

awc

Auth

Advertiser API token

TL;DR

Capture the awc query parameter on the landing page and persist it until checkout confirmation.

Generate an Awin advertiser API token, then configure TrackLayer to POST conversions to the advertiser conversions endpoint.

Validate awc, order_ref, amount, and currency in the TrackLayer dashboard before you send live commission data.

Prerequisites

  • An Awin advertiser account with access to API credentials in the advertiser dashboard.
  • Your Awin advertiser_id, the program currency you report to Awin, and the commission group names you plan to use.
  • TrackLayer installed on the storefront and able to capture landing page query parameters before consent and checkout redirects alter the URL.
  • A stable order reference from your commerce backend so retries stay idempotent and Awin can reject duplicates cleanly.
  • A voucher code mapping plan if coupon attribution matters for partner validation or commission rules.

Setup

1

Capture awc at the first landing touchpoint

Awin uses the awc click identifier to connect the conversion to the original affiliate click. TrackLayer should capture awc from the landing page query string, store it in a first-party cookie or server session, and forward it into the checkout completion event. If the shopper lands without awc, do not synthesize one. Send the conversion only when a real value exists.

// Landing page middleware or edge handler
const url = new URL(request.url);
const awc = url.searchParams.get("awc");

if (awc) {
  response.cookies.set("tl_awc", awc, {
    httpOnly: true,
    sameSite: "Lax",
    secure: true,
    maxAge: 60 * 60 * 24 * 30,
    path: "/",
  });
}

// Later, on order confirmation
const awinClickId = request.cookies.get("tl_awc")?.value ?? null;
2

Generate the advertiser API token in Awin

In the Awin advertiser dashboard, create a server-side API token dedicated to TrackLayer. Keep it out of browser code and client-side tags. Store the token in your deployment secret manager, then inject it into the TrackLayer worker or backend process that owns conversion delivery. Rotate the token on a schedule and after team access changes.

# Example secret material
AWIN_ADVERTISER_ID=123456
AWIN_API_TOKEN=awin_live_xxxxxxxxxxxxx
AWIN_CURRENCY=EUR

# TrackLayer runtime
TRACKLAYER_DESTINATION=awin
TRACKLAYER_AWIN_ADVERTISER_ID=123456
TRACKLAYER_AWIN_API_TOKEN=awin_live_xxxxxxxxxxxxx
3

Map the TrackLayer purchase event to the Awin payload

The Awin advertiser conversions endpoint expects a conversion record, not a generic analytics event. Build a purchase-to-conversion mapper that includes awc, order_ref, amount, currency, voucher_code, commission_group, and optional custom parameters. Keep amount in the advertiser account currency. If you add customer references in custom parameters, send pseudonymous or hashed values rather than raw email addresses.

{
  "awc": "7a4a4d0a8c2f11ef9fa6d6a7bff54d0b",
  "order_ref": "ORDER-10428",
  "amount": 149.95,
  "currency": "EUR",
  "voucher_code": "SPRING20",
  "commission_group": "default",
  "custom_parameters": {
    "storefront": "prestashop",
    "order_channel": "web",
    "customer_ref_sha256": "4a44dc15364204a80fe80e9039455cc1608281820fe2b24f1e5233ade6af1dd5"
  }
}
4

POST conversions server-side through TrackLayer

TrackLayer should deliver the conversion from the server after payment success, not from the browser. Use the Awin advertiser endpoint and attach the API token as the Authorization header. Treat order_ref as your idempotency key inside TrackLayer so retries do not create duplicate send attempts. Log the Awin response code and body for every attempt.

curl -X POST "https://api.awin.com/advertisers/123456/conversions" \
  -H "Authorization: Bearer $AWIN_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{
    \"awc\": \"7a4a4d0a8c2f11ef9fa6d6a7bff54d0b\",
    \"order_ref\": \"ORDER-10428\",
    \"amount\": 149.95,
    \"currency\": \"EUR\",
    \"voucher_code\": \"SPRING20\",
    \"commission_group\": \"default\",
    \"custom_parameters\": {
      \"storefront\": \"prestashop\",
      \"order_channel\": \"web\"
    }
  }"
5

Validate field normalization in TrackLayer before launch

Open the TrackLayer dashboard and inspect the queued Awin event before you send live traffic. Confirm that awc is present, order_ref matches the commerce order number, amount is numeric, and currency is uppercase ISO 4217. This is also where you catch trimmed voucher codes, wrong decimal separators, and missing commission groups before Awin rejects the call.

TrackLayer dashboard checks
→ Destination: Awin
→ Event: purchase
→ Required fields: awc, order_ref, amount, currency
→ Optional but recommended: voucher_code, commission_group
→ Response log: HTTP status, Awin body, retry state
6

Run a controlled end-to-end test with a real click id

Generate a test affiliate click, land on a URL that contains awc, place a low-value order, and confirm that TrackLayer shows the outbound request plus the Awin response. Compare the order_ref and amount in TrackLayer to the values visible in the Awin advertiser interface or API audit view. Only then enable the destination for all production purchases.

Test sequence
1. Open a landing URL that includes ?awc=test_click_001
2. Confirm tl_awc exists in cookies or session storage on the server
3. Create order ORDER-TEST-001 for 9.99 EUR
4. Verify TrackLayer sent one POST to /advertisers/123456/conversions
5. Verify Awin accepted the payload with the same order_ref

Payload notes

Required record shape

Keep the payload conversion-focused. Awin needs the click identifier plus order and commission data, not a broad event envelope. TrackLayer should normalize the field names before any retry queue stores the job.

  • awc: required click id from the landing URL
  • order_ref: stable order identifier
  • amount: numeric order value in advertiser currency
  • currency: uppercase ISO 4217 code
  • voucher_code and commission_group: recommended

Identifier handling

The core Awin conversions endpoint does not require hashed user match keys the way social ad APIs do. If you use custom parameters for internal references, prefer pseudonymous or SHA-256 values so TrackLayer logs remain safe to inspect and export.

This keeps diagnostics useful without leaking raw customer identifiers into request logs, alert payloads, or support screenshots.

Troubleshooting

Awin rejects the conversion because awc is missing.

Trace the first landing request in TrackLayer and confirm the awc parameter existed before redirects or consent flows. If the shopper did not arrive from an Awin click, suppress the Awin destination instead of sending a partial payload.

The endpoint returns an authorization failure.

Regenerate the advertiser API token, confirm the token belongs to the correct advertiser account, and make sure the Authorization header is sent from the server as Bearer token auth with no extra whitespace.

Awin rejects the amount or currency fields.

Send a numeric amount with a period decimal separator and an uppercase ISO currency code that matches the advertiser account configuration. Do not send formatted strings such as EUR 149,95.

Duplicate conversion or duplicate order reference errors appear.

Use order_ref as a stable idempotent identifier in TrackLayer and do not resend the same successful order unless you intentionally support adjustment flows. Review retry logs for network timeouts that may have triggered a second attempt.

Launch checklist

  • awc is captured from the landing page query string and persisted server-side.
  • The Awin advertiser_id matches the account that issued the API token.
  • The API token is stored only in server secrets and never exposed in browser code.
  • TrackLayer maps purchase to awc, order_ref, amount, and currency for every eligible order.
  • voucher_code and commission_group are populated when partner rules depend on them.
  • Custom parameters use pseudonymous or hashed identifiers instead of raw PII.
  • A TrackLayer dashboard test shows one accepted POST to the Awin conversions endpoint.
  • Retry logic prevents duplicate sends after timeouts or transient Awin errors.

We use essential cookies to keep the site secure and functional. Analytics and third-party tags run only with your consent. See our Cookie Policy.

We use essential cookies to keep the site secure and functional. Analytics and third-party tags run only with your consent. See our Cookie Policy.