A data layer event schema defines what a website reports when an affiliate conversion occurs. It gives checkout code, tag managers and reporting systems a common set of field names and meanings. Instead of asking each tracking tag to read an order number from the page or guess which total to use, the site publishes one structured event that each authorised destination can interpret.
The useful starting point is the business action, not the affiliate network’s tag template. Decide what counts as a conversion, which system can confirm it and what evidence you will need if a network reports a different result. Those decisions determine which fields belong in the event and which should stay in a destination-specific mapping.
Define what the conversion event means
An event named affiliate_conversion should describe a state your organisation can verify. For a retail programme, that might be a payment captured against a valid order. For a lead programme, it might be a submission accepted by the lead system. A click on a submit button is not the same as an accepted lead, just as a visit to a thank-you page is not necessarily proof of payment.
Put the firing rule in the schema documentation. For example, a purchase event may be emitted when the order service confirms that payment has been captured and returns the order reference, commissionable amount and currency. A page refresh or a return visit can display that same receipt, but neither creates a new conversion. If your programme pays on a later milestone, such as a qualified lead or a completed stay, define that milestone separately instead of treating the earlier browser event as payable.
Set the minimum field contract
For each field, document its type, allowed values, source of truth and whether it is required or conditional. Spell out what happens when a value is missing. A field with an empty string, a field set to null and a field that is absent can trigger different behaviour in a tag manager or network adapter.
- event: A stable name used to trigger consumers. Use one agreed spelling, such as affiliate_conversion, and carry the business action in a separate field.
- schema_version: The version of the event contract, such as the integer 1. Consumers can use it to distinguish incompatible payloads during a rollout.
- conversion_id: A stable reference for the conversion, such as an order ID or an opaque lead ID. Retries for the same conversion must retain it. If references can overlap between storefronts, include a storefront identifier in the deduplication scope.
- conversion_type: A controlled value such as purchase or qualified_lead. Document each value and the state transition it represents.
- occurred_at: The time the business system recorded the qualifying action, in a documented UTC format. Keep this separate from the time a tag fired or a network received the event.
- click_id: The eligible affiliate click reference, where collection and use are permitted. Treat it as an opaque string so leading zeros and case are preserved. If there is no eligible reference, follow the documented missing-value rule rather than inserting a placeholder.
- amount_minor and currency: The commissionable amount as an integer in the currency’s minor units, paired with an uppercase ISO currency code. Make these required for value-based purchases and define their treatment separately for fixed-fee leads.
Make the amount reproducible
Suppose an order has £75 of merchandise, a £5 merchandise discount and £4 of shipping. If the programme uses merchandise net of discounts and excludes shipping, the event should carry an amount_minor of 7000 and a currency of GBP. A network that expects major units receives 70.00 after mapping. Document how taxes, gift cards and excluded products affect the amount, and apply the correct currency exponent rather than assuming every currency uses two decimal places.
Keep attribution separate from the conversion
The order system can confirm a sale without deciding which partner gets credit. The attribution component should supply the eligible click reference according to your programme rules, including the lookback window and how competing clicks are handled. Recover that reference from approved storage or a server-side session, not from whichever tracking parameter happens to appear on the confirmation page. If it routinely disappears before checkout, review click ID propagation before changing the conversion schema.
Keep the internal field names consistent across networks. One destination might call the click reference clickref, while another expects it under a different parameter. Map the field at the delivery boundary, where you can also handle encoding and omit unsupported values. This is where macro parameter hygiene matters: an unresolved macro or a doubly encoded identifier can leave a valid order unmatched. Keep emails, phone numbers and full addresses out of a shared browser data layer; the conversion reference is usually enough to reconcile a result internally.
Design for retries and later adjustments
Client-side tags may run twice, and server deliveries may be retried after a timeout even though the network accepted the first request. Use a stable deduplication key and check which field the destination actually uses to reject duplicates. A common internal key combines storefront, conversion type and conversion ID. If both browser and server tracking report the same purchase, they must share a key the destination recognises, or only one route should submit the payable conversion.
Handle refunds, cancellations and changes as adjustments linked to the original conversion, not as fresh purchases. Give each adjustment its own stable reference so two partial refunds can be distinguished from one refund delivered twice. Specify whether your internal adjustment value means the amount refunded or the remaining commissionable amount. Translate that meaning into the destination’s expected format rather than assuming all networks interpret negative values the same way.
Validate the schema against real reporting questions
Test the contract at three points: the event produced by the site, the request built for the destination and the result recorded by the destination. A tag manager preview can confirm that an event fired, but it cannot confirm that the network accepted the request or credited the expected partner.
- Run a valid affiliate purchase and compare its conversion ID, click ID, amount and currency at all three points.
- Repeat the delivery and reopen the confirmation page. Verify that neither action creates a second payable record.
- Test a missing or expired click reference and a case where tracking is not permitted. Confirm that the order still completes and that no fabricated attribution is sent.
- Test a discounted order and a partial refund. Reconcile the original commissionable value and adjustment with the programme rules and the network report.
- Submit an event with a missing required field. Check that the integration records a useful validation error rather than silently sending a malformed request.
For reconciliation, retain the conversion reference, schema version, destination, delivery attempt time and response status in an access-controlled log with a defined retention period. Where the network provides a receipt or transaction reference, capture it as well. This lets you distinguish an event that was never produced from one that was rejected, duplicated or accepted but not attributed. That distinction is what makes the schema useful after launch: it gives tracking and finance teams a shared record to investigate instead of forcing them to reconstruct the sale from a tag preview.
