Import Historic Data Into Segment with Segment CSV Importer

Let's start

Managing, integrating and transferring live user data to several tools and warehouses at the same time all the while maintaining its integrity, requires a lot of coding and remodeling efforts. There has to be a simpler way to do it, so that the process involved not only minimizes the overall size of your data but also makes it more comprehensible.

Here is where Segment comes in. It can track your data and send it to multiple tools in real time but what about your old data? The historical user data that was collected before integrating the said Segment? Nonetheless, the previous data is equally essential for accurate reporting as the new one and you would never like to put into the trash because it can help develop future plans.

For this purpose we use a Segment CSV Importer.

 

Segment CSV Importer:

Segment CSV Importer allows you to import all of your historic data in the form of a CSV file to Segment in a matter of seconds. All you need to do is upload your CSV file to Segment CSV Importer and it will send your data to Segment which in turn sends it to all your integrations.

 

How does it work?

Segment CSV Importer upon loading asks you to enter your segment write key and upload your CSV file.

To open the app please visit: https://segmentcsvimporter.herokuapp.com/ 

 Segment CSV Importer view

CAUTION

Use a test account to send data before you try it on your live account.The stuff below is permanent and in most cases can’t be removed. Use extreme caution. Setup a separate test segment account and test accounts for any integration you use in segment. Usual disclaimers about shared as is no responsibility apply.

 

Note: Before importing you are required to enable the integration from inside segment where you want to send this data. 

 

Where to find Write key?

The write key allows our app to connect with your workspace.A workspace is a bunch of sources, linked together in a way that they are controllable under the same spectrum.  You can think of write key as a unique identifier that performs two basic operations:

  • Inform the segment about the source that generated or produced the data
  • Where that data should be implied to and which integrations (business tools and apps interlinked via a segment) and workspaces should receive it

1.         Navigate to segment.com

2.         Login with your account

3.         Select your desired workspace.It will take you to your sources.

4.         Click on the required source.

5.         Click settings.

 goto segment settings

6.         On the left click API Keys

 api keys

api keys

 write key

Now copy this write key and paste it in write key space in the app.

 paste write key

Next, click on choose file button to upload your data in .csv format.

 upload file

After you choose your file it will give you basic format of your file and first three records from your CSV file.

 file record

Now click “Import” at the bottom left of the page. [see caution above]

If all OK a message will be displayed saying “data sent”.

That’s All. It’s just that simple.

 

CSV File Specifications:

Now your CSV file should have some mandatory fields for the app to detect your action you want to perform with your data. Segment supports 3 import actions.

·             Identify (Who is the customer?)

·             Track (What are they doing?)

·             Alias (What was their past identity?)

For more Detail Information please visit: https://segment.com/docs/spec

So your CSV should have following fields:

·             Action (above mentioned)

·             User ID

·             Anonymous ID

·             Timestamp (yyyy-MM-dd’T’HH:mm:ss.SSS’Z’) details

               ( https://www.w3.org/TR/NOTE-datetime)

·             Integrations (integration you want to send data)

·             Event

·             Properties/traits

Example:

 csv file example

CSV Format for ‘Identify’

segment.com/docs/spec/identify/

 CSV format for identity

Highlighted are the required fields.

action : ‘identify’

userid

anonymousid : id generated by browser/computer

Timestamp format : yyyy-MM-dd’T’HH:mm:ss.SSS’Z’ (UTC format)

Traits are associated with users so that means email, first_name, last_name, joined_via are traits of the user. They are to be written as ‘traits.xxx’ showing this value is a trait.

Let’s say you have a user which has traits first_name last_name

To send this you would do

action user traits.first_name traits.last_name
identify name john doe

Here is a sample CSV format for your ease.

CSV Format for ‘Track’

segment.com/docs/spec/track/

 csv format for track example

Highlighted are the required fields. All fields are case sensitive

action: track

userId: user id of user used in segment

anonymousId:  id generated by browser/computer

Timestamp format:  yyyy-MM-dd’T’HH:mm:ss.SSS’Z’ (UTC Format)

Integrations shows that what tool you want to send your data to. It has to be written as integrations.xxxx.

Track action uses properties which are associated with events. Any action on the web page is an event. A page visit is an event. A button click is an event. Email, first_name, last_name, joined_via are properties of an event. They have to be written as properties.xxxx.

Let’s say you have an existing event purchased which has properties plan_name plan_value

To send this you would do

action event properties.plan_name properties.plan_value
track purchased pro 140

Here is a sample CSV format for your ease.

CSV format for ‘Alias’

segment.com/docs/spec/alias/

 csv format for alias example

Highlighted are the required fields.

action : track

userId

previousId : any id that was set it could be anonymous or custom

Timestamp format : yyyy-MM-dd’T’HH:mm:ss.SSS’Z’ (UTC)

Here is a sample CSV format for Alias.

Use this app to import your historic data to segment and in case of any questions or queries please feel free to contact us.

And please be sure to recommend it to others 🙂

Don't miss out when new resources launch

Our customer analytics experts share wisdom only once a month

Share now
We are customer-analytics consultancy that transforms messy data into actionable insights that will help you grow your company and make better data-backed decisions.