The root of the XML file is the <orders> element, which contains one <order> element for each order.
Each <order> element contains the following information as attributes:
- reference code (refCode) of the order (or order number)
- order date. The value for orderDate must be in the format defined by ISO 8601 “Date and Time Formats”.
- currency that the order was placed in. The value for currency must be from the available Currency codes, which are in the 3-letter format defined by ISO 4217 “Currency codes”.
- total value of the order. The subtotal, and shipping cost are optional for offline orders. For example:
<order refCode="orderRef123" orderDate="2017-04-23T14:25:00 GMT" currency="GBP" total="100.0">
Each <order> element contains the following as sub-elements:
- The <user> element is optional for offline orders. If present it should contain the email of the user who placed the order. You should include it to improve the accuracy of the online product recommendations presented to those customers.
The element must include an XML attribute specifying the user’s email address. For example:
- You must have at least one <product> element per order. The element contains the product's reference code (as provided in the product catalog feed for Optimizely), the ordered quantity, and ordered price (per unit). For example:
<product refCode="CB4551" qty="1" price="6.5"> </product>
The <product> element can be empty or include a number of sub-elements containing information about the product’s attributes. If supplied, the product’s <attribute> element needs to contain an XML attribute (which consists of a name-value pair specifying the name of the product’s attribute, such as key="pricerange") and a value (such as cheap). For example:
<product refCode="CB4551" qty="2" price="6.5"> <attribute key="pricerange">cheap</attribute> </product>
Note: The price should be the final price per unit that the user paid for the product. Also, information given in the product’s <attribute> element is only imported into the database if it matches the associated information from the online-data feed. That is, if the product’s attribute name or value differs from what is in the database for that product, the new attribute is not imported into the database.
- The <attribute> element is optional; use it to specify attributes related to the order. You can specify multiple instances of this element. If supplied, the order’s <attribute> element must contain an XML attribute (which consists of a name-value pair specifying the name of the order’s attribute, such as key="transaction") and a value (such as debitcard). For example:
The following table lists the XML elements and their attributes.
|XML element names||XML attribute names||XML attribute value examples||XML element value examples|
|customerId (optional for offline and historical orders)||customer123|
|shipping (optional for offline orders only)||10.00|
|subTotal (optional for offline orders only)||90.00|
|user (optional for offline orders only)||email (optional for offline orders only)||firstname.lastname@example.org (optional for offline orders only)|
|attribute (optionalfor offline and historical orders)||key||pricerange||cheap|
Last updated: Nov 06, 2017