Search through more than a hundred articles on every aspect of User.com

Marcin Szczygieł
Written by Marcin Szczygieł

Events import via CSV file

Learn how to add Events into your database via CSV file


Before you start

Prepare your CSV file with the following in mind:

  • Always include column headings.
  • If you are exporting a CSV file from Excel, make sure there are no cells left out.
  • Data format matches the data format of your attributes. So if you have an attribute, 'Scoring', which should include an integer, it doesn't make sense to put its value as 'Frank'. If you are exporting from Excel, make sure that you set the correct data formats for each cell.

Please, take note: Deals CSV importer interpretes the following columns:

  • user_id (string) - Unique ID provided in user model - user_id
  • email (string)
  • datetime (date time) - format 'YYYY-MM-DD 12:02:01'
  • event_name (string)
  • attrs (JSON object) - { 'key': 'value'}

Event attributes should be placed in a specific way - each 'key': 'value' pair has to be pasted in another column. As an example we've got an event with 3 attributes:

Note few things:

  • there is no separator between objects,
  • each specific object is placed in the other column,
  • not forget about closing curly bracket.

You can find an example file here.

How to do it

  1. Go to Settings > Importers > Import Events.
  2. Prepare your Events list in .csv format as in the example provided in every import section found on that page (email, datetime, event_name, etc.).
  3. You have the option to drag and drop or click the box to upload your CSV.
  4. The Encoding has to be selected as UTF-8.
  5. Choose the Separator that you have used in your CSV.
  6. Once all previous set has been set up, click on the 'Import' . Then the import process will begin, and your import will appear at the bottom of the list of imports.

Google Sheets file edit

Every attribute object has to be inside single quotes, e.i. 'key'. While editing your file in the Google sheet, there is a one important rule. Unfortunately, Google sheet omits every single quote if it appears as a first character in the line. To get rid of that problem you have to type single quote twice and it'll be correct in that Google sheet and in the csv file after it's been exported. Example:

Related articles:

Categories: