Emarsys allows you to import sales data of any type, including daily sales files, returns and cancellations, and offline data from your physical stores.
To upload sales data into Emarsys, open your account and go to Admin > Data Sources. In the SALES DATA box, click Manage sales data. This will take you to the Sales Data page.
- Formatting your sales data file
- Uploading sales data manually
- Using the sales data API
Formatting your sales data file
Sales data is expected to be a UTF-8 encoded .csv file (if you are not sure how such file should look, a sample file can be downloaded from this page). Each record in the file is an order line which describes a single element (one specific item in some quantity and at some total price) of the order. There are a number of standard columns which are necessary for reporting, and you can also add your own custom columns.
||Yes||String||BOOK0012||The unique product identifier, exactly as it appears in the
||Yes||Float||110.30||The total price of the order line (the unit price multiplied by the quantity) in the default currency defined in the Account Details box of your Data Sources page.|
||Yes||String||111-U8||The unique identifier of the order (an order may contain multiple order lines).|
||Yes||Timestamp||2016-06-06T14:02:00Z||The date (and optionally the time) of the transaction (in UTC timezone). If only the date is specified (e.g.
||Yes (one of
||String||12343-14B||The anonymous unique identifier of the customer making the order, if your CRM uses one. This must be an external key pointing to the externalID field in your Emarsys database.|
||email@example.com||The email address of the customer making the order, if you identify your customers by email address. Do not use this column if
||Yes||Float||5||Quantity (number) of purchased item(s).|
There may be optional custom columns in addition to the standard columns specified. Custom column names have a single character prefix which denotes their type, followed by an underscore (
_) and the name of the custom column. Custom columns may not be empty and may not contain data with the wrong type, otherwise the file will not validate.
|Column Name Pattern||Type||Example Column Name|
|Integer||Normal integer, no decimal or thousands separator.|
|Float||Uses dot (
|Timestamp||Date of the form YYYY-MM-DD or timestamp of the form YYYY-MM-DDTHH:MM:SSZ, e.g.
|String||Optionally quoted string,
|Email address format, eg: firstname.lastname@example.org|
Sales Data Examples
The following example shows orders for a shoe store with two custom columns:
item,price,order,timestamp,customer,quantity,s_color,f_size,t_published 103-nike-1,24.95,112343,2016-06-06T14:02:00Z,093275854,1,blue,14.5,2016-09-20T15:00:00Z 105-adidas-66,99.95,112343,2016-06-06,493027334,3,black,14.5,2016-09-20T15:00:00Z 107-nike-24,50.99,66234,2016-06-06T17:00:00Z,672985375,1,pink,13.5,2016-08-01
- And here you can download a sample sales data import file.
Uploading sales data manually
Once you are sure that your file containing your sales data has been correctly formatted as described above, you should upload it through the Sales Data page. It is safe to submit the same file multiple times, as this will not result in duplicate data.
A manual upload is the preferred method for uploading data such as historical sales data during the onboarding process, as it allows you to validate the file and correct any errors straight away. Proceed as follows:
- On the Sales data page, click Validate/upload file.
- Browse for your sales data file and select it.
- Emarsys will then validate your file.
- If no issues are detected, finalize the upload by clicking the Activate upload button.
Using the sales data API
The easiest way to import sales data regularly to Emarsys is to use our simple HTTP API endpoint. When you click the Show API upload details button on the Sales Data page, all information you may need will be provided so that you can set up the import with minimal effort.
|merchant-id||string||Your 16-letter merchant ID provided by Emarsys.|
The request should contain an
Authorization header with the following value:
<token> is a security token, which can be obtained by clicking the Show API upload details button on the Sales Data page.
?live=true must be appended to the endpoint URL if the API is called after each purchase event in a separate request or more often than every 5 minutes. In this case, live events are bundled, validated and submitted hourly by our servers.
Gzip compression is supported. To upload gzip compressed files, use the
Content-Encoding: gzip header.
|200||Upload is accepted (with possible warnings)|
|400||Upload is rejected due to errors|
|401||Security token is invalid or missing|