Import data using CSV
You can import your customer, product, order, event and custom data into Optimizely Data Platform (ODP) using CSV files. You should use this method for historical data uploads rather than ongoing data synchronization.
Upload data
To upload your data with a CSV file:
- Go to Account Settings > Integrations.
- Click Upload CSV.
- You can drag and drop your file onto the page or click browse to search for the file on your device.
Note
Each file you upload must meet the format and naming requirements described below.
File format requirements
️ Warning
Values that are blank ("") or null will DELETE the field value.
For example, if you upload a file with a
gender
column and there is a customer record without that column filled, that will erase what is presently on the customer record.
- Values must be encoded with
UTF-8
. - Values must be comma-delimited.
- Records must end with a newline (
\n
), and no carriage return (\r
) or newline (\n
) may exist within a record. - Optionally, values must be quoted using double quote (
"
) characters. You must quote any field containing a double quote. The escape character for an embedded quote is a second quote character. (For example:"Customers think this product is ""Amazing!"""
) - Each record must contain exactly the same number of fields as the header does,
- Date/time fields must be formatted as follows:
Date Format | Example |
---|---|
Unix timestamp/epoch | 1435708800 |
ISO 8601 | 2019-04-11T18:43:29+00:00 2019-04-11T18:43:29Z 2019-04-11 |
%Y-%m-%d %H:%M:%S%:z | 2014-09-01 13:34:08+00:00 |
%Y-%m-%d %H:%M:%S | 2014-09-01 13:34:08 |
%m/%d/%y %H:%M | 09/01/14 13:34 |
%m/%d/%y %H:%M:%S | 09/01/14 13:34:08 |
%m/%d/%Y %H:%M:%S | 09/01/2014 13:34:08 |
%m/%d/%Y %H:%M | 09/01/2014 13:34 |
Caution
If time and time zone are not provided, the time is assumed to be 12 AM UTC.
Error handling
Any record that contains an invalid field is ignored. If more than 1% of the data is invalid, the entire file is rejected. Go to Account Settings > Activity Log to view the status of the uploads. On that page, you can view any errors generated and successful upload entries.
File name requirements and example CSV files
Note
The example files are simple examples. See the ODP schema section to learn about available default and custom fields and objects.
Object | File name prefix | Example file | Comments |
---|---|---|---|
Customers | zaius_customers | zaius_customers_example.csv | |
Products | zaius_products | zaius_products_example.csv | |
Orders | zaius_orders | zaius_orders_example.csv | See the Orders fields section |
Events | zaius_events | zaius_events_example.csv | Use an identifier field, such as order_id , to properly associate the event with a customer profile. |
Lists | zaius_list | Upload to a Single List zaius_list_yourlistidhere.csv Upload to Multiple Lists zaius_list_example.csv | See the Lists imports section |
Custom | zaius_customobject | zaius_customobject_example.csv | Replace customobject with the name of the custom object. All custom object updates must include the primary key (or keys in the case of composite keys) in the file (for example, id ). |
Orders fields
Orders in ODP are represented both as Events and as Orders objects. The Events object stores item-level fields, meaning products that a customer purchased. The Orders object stores top-level order fields, meaning the order total, taxes, discounts and customer information. Format the file using one of the following options:
- (Recommended) Repeat the top-level order fields for each line item in a purchase. The top-level fields must be identical on each row of the purchase.
- Leave the top-level order field blank after the first row for each subsequent line in the purchase and only provide shared and item-level fields.
Field | Shared/top-level/item-level | Comments |
---|---|---|
action | shared | value should be one of the following: `purchase refund return cancel` |
order_id | shared | required |
ts | shared | required |
identifier | shared | any identifier is accepted |
total | top-level | |
discount | top-level | |
subtotal | top-level | |
tax | top-level | |
shipping | top-level | |
coupon_code | top-level | |
first_name | top-level | |
last_name | top-level | |
bill_address | top-level | |
ship_address | top-level | |
item_product_id | item-level | one row per line item |
item_sku | item-level | one row per line item |
item_price | item-level | one row per line item |
item_quantity | item-level | one row per line item |
item_discount | item-level | one row per line item |
item_subtotal | item-level | one row per line item |
Caution
You cannot update order item-level fields (and the associated events) in the future; only top-level fields (for refunds, returns, cancellations).
Note
Prefix all custom event fields with
item_
to indicate the field exists on the Events object. Otherwise, ODP assumes you are attempting to update the Orders object.
Lists imports
- Use an identifier field, such as
email
, in the CSV file. Optionally, include anaction
field (subscribe
orunsubscribe
). If you do not include anaction
column, ODP assumes a subscription for each email. - Only some accounts have the optional
customer_id
field. If your account does not have this field, do not include it in your import file. Additionally, if an email value is available, do not use the optionalcustomer_id
field. Only use thecustomer_id
field when an email is not available. - A list import does not update the customer record with new or changed attributes, it just adds customers to a list/subscription.. To update the customer record with new or changed attributes, use the Customers import.
Import marketing consent data
In ODP, marketing consent is an attribute of each identifier (for example, each email address), not the entire customer profile, and is not updated by the customer data import.
To import marketing consent data, see Understand marketing consent. File names for consent imports begin with zaius_events
. If no value is provided for consent (null), consent is implied.
Updated 12 months ago