Example
Multiregionality
If the integration requires the using of regions (stocks), then the ID of the region in which the user is located must additionally be passed to the tracking code.
All code examples are shown on two tabs - with and without regionality support.
<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="2018-09-25 17:22">
<shop>
<categories>
<category id="1278">Electronics</category>
<category id="1293" parentId="1278">Smartphones</category>
<category id="1345" parentId="1278">Phones</category>
<category id="3761" parentId="1278">TVs</category>
<category id="1553" parentId="3761">Media-players</category>
<category id="3798">Appliances</category>
</categories>
<offers>
<offer id="1637" available="true">
<url>http://example.com/product/id1637</url>
<price>226.50</price>
<oldprice>250</oldprice>
<categoryId>1293</categoryId>
<categoryId>1345</categoryId>
<picture>http://example.com/images/1637_1.jpg</picture>
<name>Product 1</name>
<param name="Color">Black</param>
<description>Description of the product 1637</description>
<vendor>Vendor name</vendor>
<model>Model of the product</model>
</offer>
<offer id="1638" available="false">
<url>http://example.com/product/id1638</url>
<price>545.30</price>
<categoryId>1293</categoryId>
<categoryId>1345</categoryId>
<picture>http://example.com/images/1638_1.jpg</picture>
<name>Product 2</name>
<param name="Color">White</param>
<description>Description of the product 1638</description>
<vendor>Vendor name</vendor>
<model>Model of the product</model>
</offer>
</offers>
</shop>
</yml_catalog>
<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="2018-09-25 17:22">
<shop>
<categories>
<category id="1278">Electronics</category>
<category id="1293" parentId="1278">Smartphones</category>
<category id="1345" parentId="1278">Phones</category>
<category id="3761" parentId="1278">TVs</category>
<category id="1553" parentId="3761">Media-players</category>
<category id="3798">Appliances</category>
</categories>
<offers>
<offer id="1637" available="false">
<url>http://example.com/product/id1637</url>
<price>226.50</price>
<oldprice>250</oldprice>
<categoryId>1293</categoryId>
<categoryId>1345</categoryId>
<picture>http://example.com/images/1637_1.jpg</picture>
<name>Product 1</name>
<param name="Color">Black</param>
<description>Description of the product 1637</description>
<vendor>Vendor name</vendor>
<model>Model of the product</model>
<stock id="Spain">
<available>true</available>
<price>230.30</price>
<oldprice>252</oldprice>
<url>http://example.com/product/id1637</url>
<picture>http://example.com/images/1637_2.jpg</picture>
</stock>
<stock id="Italy">
<available>false</available>
<price>235</price>
<oldprice>251.60</oldprice>
<url>http://example.com/product/id1637</url>
<picture>http://example.com/images/1637_2.jpg</picture>
</stock>
</offer>
<offer id="1638" available="false">
<url>http://example.com/product/id1638</url>
<price>545.30</price>
<categoryId>1293</categoryId>
<categoryId>1345</categoryId>
<picture>http://example.com/images/1638_1.jpg</picture>
<name>Product 2</name>
<param name="Color">White</param>
<description>Description of the product 1638</description>
<vendor>Vendor name</vendor>
<model>Model of the product</model>
<stock id="Spain">
<available>true</available>
<price>500</price>
<oldprice>550</oldprice>
<url>http://example.com/product/id1638</url>
<picture>http://example.com/images/1638_2.jpg</picture>
</stock>
<stock id="Italy">
<available>true</available>
<price>540.50</price>
<oldprice>600</oldprice>
<url>http://example.com/product/id1638</url>
<picture>http://example.com/images/1638_3.jpg</picture>
</stock>
</offer>
</offers>
</shop>
</yml_catalog>
<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="2018-09-25 17:22">
<shop>
<categories>
<category id="1278">Electronics</category>
<category id="1293" parentId="1278">Smartphones</category>
<category id="1345" parentId="1278">Phones</category>
<category id="3761" parentId="1278">TVs</category>
<category id="1553" parentId="3761">Media-players</category>
<category id="3798">Appliances</category>
</categories>
<offers>
<offer id="1637" available="true" group_id="12345">
<url>http://example.com/product/id1637</url>
<price>226.50</price>
<oldprice>250</oldprice>
<categoryId>1293</categoryId>
<categoryId>1345</categoryId>
<picture>http://example.com/images/1637_1.jpg</picture>
<name>Product 1</name>
<param name="Color">Black</param>
<description>Description of the product 1637</description>
<vendor>Vendor name</vendor>
<model>Model of the product</model>
</offer>
<offer id="1638" available="false" group_id="12345">
<url>http://example.com/product/id1638</url>
<price>545.30</price>
<categoryId>1293</categoryId>
<categoryId>1345</categoryId>
<picture>http://example.com/images/1638_1.jpg</picture>
<name>Product 2</name>
<param name="Color">White</param>
<description>Description of the product 1638</description>
<vendor>Vendor name</vendor>
<model>Model of the product</model>
</offer>
</offers>
</shop>
</yml_catalog>
<?xml version="1.0" encoding="UTF-8"?>
<yml_catalog date="2018-09-25 17:22">
<shop>
<categories>
<category id="1278">Electronics</category>
<category id="1293" parentId="1278">Smartphones</category>
<category id="1345" parentId="1278">Phones</category>
<category id="3761" parentId="1278">TVs</category>
<category id="1553" parentId="3761">Media-players</category>
<category id="3798">Appliances</category>
</categories>
<offers>
<offer id="1637" available="false" group_id="12345">
<url>http://example.com/product/id1637</url>
<price>226.50</price>
<oldprice>250</oldprice>
<categoryId>1293</categoryId>
<categoryId>1345</categoryId>
<picture>http://example.com/images/1637_1.jpg</picture>
<name>Product 1</name>
<param name="Color">Black</param>
<description>Description of the product 1637</description>
<vendor>Vendor name</vendor>
<model>Model of the product</model>
<stock id="Spain">
<available>true</available>
<price>230.30</price>
<oldprice>252</oldprice>
<url>http://example.com/product/id1637</url>
<picture>http://example.com/images/1637_2.jpg</picture>
</stock>
<stock id="Italy">
<available>false</available>
<price>235</price>
<oldprice>251.60</oldprice>
<url>http://example.com/product/id1637</url>
<picture>http://example.com/images/1637_2.jpg</picture>
</stock>
</offer>
<offer id="1638" available="false" group_id="12345">
<url>http://example.com/product/id1638</url>
<price>545.30</price>
<categoryId>1293</categoryId>
<categoryId>1345</categoryId>
<picture>http://example.com/images/1638_1.jpg</picture>
<name>Product 2</name>
<param name="Color">White</param>
<description>Description of the product 1638</description>
<vendor>Vendor name</vendor>
<model>Model of the product</model>
<stock id="Spain">
<available>true</available>
<price>500</price>
<oldprice>550</oldprice>
<url>http://example.com/product/id1638</url>
<picture>http://example.com/images/1638_2.jpg</picture>
</stock>
<stock id="Italy">
<available>true</available>
<price>540.50</price>
<oldprice>600</oldprice>
<url>http://example.com/product/id1638</url>
<picture>http://example.com/images/1638_3.jpg</picture>
</stock>
</offer>
</offers>
</shop>
</yml_catalog>
Note that when you are using regionality (stocks), the "available" parameter in each offer must be set to "false".
Current availability is indicated by a separate <available> tag inside each <stock>.
<offer id="1638" available="false">
----------other parameters----------
<stock id="Spain">
<available>true</available>
----------other parameters----------
</stock>
</offer>
Mandatory elements of XML
Element | Description |
---|---|
xml header | Standard XML header. Must start with the first line, with a null character; |
yml_catalog | Any XML document can contain only one root element. This format uses the <yml_catalog> element with the date attribute as its root. In the attribute, you must specify the date and time of the moment at which the data in the file is relevant. The date must be in the format YYYY-MM-DD hh:mm. |
shop | The shop element contains: - Element categories with information about categories: title, hierarchy, identifiers; - The offers element with a list of store offers. Insert one offer element for each offer into this element; |
categories | Includes declarations of every category The category structure (hierarchy) in the XML file must match the main menu of the website. |
category | Declaration of single category of store. Element attributes: "id" - number, category identifier; "parentId" - parent category ID (creates nesting). Note: Category nesting level has a limit, there can't be more than 15 nested categories; |
offers | Includes declaration of all product offers |
offer | Declaration of a product offer with a description. Element attributes: "id" - number, product offer identifier; "available" - indicates the availability of a product offer. May be true or false; Grouped products support: "group_id" - number, product group ID. Combines all offers that are variations of the same product. It should have the same value. The value must be an integer. If the product is not a group offer, then this parameter should not be used. |
name | Name of a product offer. |
url | Link to a product page of a product offer. The link should be permanent, begin with http or https. |
picture | Link to a picture of a product offer. The link should be permanent, begin with http or https. Images should have resolution lower than 400x400px or their size should be lower than 1 MB. |
price | A price for a product offer, no spaces, the fractional part is indicated by a dot. |
categoryId | Number, identifier of a products category. It could be specified several times. One parameter should contain only one identifier. If the product is placed in multiple categories, you can specify multiple <categoryId> parameters. If there are several parameters, the main category of the product must be indicated first. |
description | Description of a product. The description could contain html code. In order to use html you should "wrap" description in ]]>. Note, that description should not exceed 200 characters. |
Additional parameters
Element | Description |
---|---|
oldprice | Old price of a product, no spaces, the fractional part is indicated by a dot. |
vendor | Products vendor name. |
model | Products model. |
param name | Each product offer you could contain up to 40 additional parameters. Usually, these parameters are the volume, type of material, the size of the diagonal, the size of the discount and others. Additional parameters are taken into account in calculating recommendations and could be displayed in emails and widgets. The maximum length of parameter values is 300 characters. Example: 1. Parameter addedDate is used to display new products at the website: <param name="addedDate">2022-04-28</param> In its value, you need to pass the date of adding the product in the format YYYY-MM-DD 2. The Size parameter is used to personalize recommendations based on the size that the user is interested in:: <param name="Size">S</param> |