The Custom importer makes it possible to quickly load simple feeds into Datatrics. These feeds can contain content items, but in the future we will also support conversions and profiles. Imported content can for example be used for product recommendations. The expected file types for the custom importer are .csv or .xml.
1. What should my files look like?
Two different types of files can be used for the importer (.csv and .xml). Below you will find an example of both file types and the structure that is expected.
1.1 CSV file
A CSV file (values separated by commas) is a special file type that you can create or edit in Microsoft Excel for example. Make sure that the separator is a comma, there are options for different separators but only commas are accepted.
Example of a file:
id,name,description,price #The header of the CSV file
1,test name,short description,12.50 #A row with values
The names in the header must be unique. For example, there can’t be "id,id" in the header.
1.2 XML file
The other accepted file type is XML. XML syntax is made up of formal markup languages that allow structured data to be displayed in the form of plain text. Its presentation is both machine-readable and readable by humans.
Below you can find an example of what a XML feed should look like for our Importer.
<?xml version="1.0" encoding="UTF-8"?>
<item> #element name used for the importer
When importing an XML file (Chapter 2), the element name is requested. The example above has a #comment on the element name you need to enter there. This is where the element (that is seen as a separate item) starts.
2. How do I import my own file?
When starting an import, you will see the following screen:
Click on one of the "Create Import" buttons to start the process.
2.1 Choose between XML and CSV
As soon as the “Create Import” button is clicked, a new screen will open where you can choose between uploading a file (this must always be a CSV file) or Loading a file from an URL (this must always lead to an XML file).
2.1.1 Uploading a CSV file
To upload a CSV file, click on the large box "Drop file here or click to upload". This will open your computer's explorer to select a file. After selecting click on "Okay", the "Next" button in the top right will become available once the file is correctly uploaded.
2.1.2 Loading an XML file from a URL
For loading an XML file there are a number of fields that need to be filled in correctly.
In the field "Resource Location" a url must be placed that refers to a file in XML format. As soon as the content has been retrieved, the icon on the right of the input field will change to a green check mark. If something has gone wrong, an error message will appear. This may have something to do with the "Element" field.
An XML file consists of several elements that are put together in the file. Type the name of the element where a single content item starts. Then click “Enter” on your keyboard. This will fetch the file again.
When the XML file has been uploaded correctly a new element will be shown. In this element you can define how often the XML file should be updated.
2.3 Basic settings for the import
As soon as the chosen type of file is retrieved correctly, an overview will be displayed as shown in the figure below. Here you can enter a name for the import, what the item type is and you can choose (or create) the unique identification field of the item.
2.3.1 Item types
We accept several types of content. Below you can find an overview of the choices that are currently available.
2.3.2 Unique identifier
Each item in Datatrics’ content has a unique identifier with which an item can be found. Depending on the header or keys found in the upgrade file you can choose one of these to be used as an id. Often these are already called "id" or "Product ID" in most feeds.
If there is no unique value in the file that can be used as a unique key, the Datatrics generated value can also be chosen.
2.4 Mapping the data
After choosing a name, id and type, the fields listed in the feed must be mapped or connected to the fields that will be used within Datatrics.
When the page is loaded, it will contain different rows depending on the loaded document. Every row has the following five columns:
You can find the explanation per column below:
1. Here you can indicate whether or not the field should be imported.
2. The name of the field according to the loaded file.
3. The name of the new field to be used within Datatrics. A name will be entered here by default. This is the name of the loaded file but without capital letters and no break spaces. Here is the possibility to give a name of your own, to leave the name as is, or to link one of the Datatrics fields to it by clicking on it. Using Datatrics fields as much as possible is strongly recommended. The Datatrics fields are the basic fields that are often used within the platform. These do not all have to be used, but use them where possible.
In the table below you can find the Datatrics fields.
A Datatrics field will always fix a type to the type expected for the field. As shown in the example below, this type cannot be changed because the field 'name' is a Datatrics exclusive field.
4. A piece of sample data from the uploaded file.
5. If you have entered your own field name, you can choose from a number of types to assign to that field.
Repeat these five options for all the rows! When all this is done you can click on the “Next” button in the top right corner.
2.5 Finish the import
The next page is the last page. It shows how many fields have been selected for the import and the name of the import.
Click on "Start Import" to finish the process.
Now wait for the process to be completed. This can take up to 15 minutes.
When the import is completed, the loading icon will change to a check mark and the total number of imported items will be displayed.
2.6 Finding your content
To view the imported data click on "content collection". This will take you to the content bin. The content should be visible here. Click on the collection with the name of the import to only see the items created by the import.