Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

XML elements

Describes the XML elements for offline and historical orders.

The root of the XML file is the element, which contains one element for each order.

Each 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 element contains the following as sub-elements:

  • The 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:

    <user email="[email protected]"></user>
    
  • You must have at least one 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 element can be empty or include a number of sub-elements containing information about the product’s attributes. If supplied, the product’s 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 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 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 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:

    <attribute key="transaction">debitcard</attribute>
    

The following table lists the XML elements and their attributes.

XML element names XML attribute names XML attribute value examples XML element value examples
orders      
      order refCode orderRef123  
  orderDate 2017-04-23T14:25:00 GMT  
customerId (optional for offline and historical orders) customer123
  currency GBP  
  shipping (optional for offline orders only) 10.00  
  subTotal (optional for offline orders only) 90.00  
  total 100.00  
        attribute (optional) key tillname Till3
    user (optional for offline orders only) email (optional for offline orders only) [email protected] (optional for offline orders only)  
    product refCode CB4551  
    qty 1  
    price 6.5  
       attribute (optionalfor offline and historical orders) key pricerange cheap