Segment.io is used to get the data from a data source and transfer it to a destination. Treasure Data has native connectivity with Segment (formerly Segment.io) for ingesting data. The connection is set up in the Segment UI with a TD API key. Data ingestion happens every minute, so you can query data almost in real-time.


Create a Segment Account

Set up your Segment account from here or login to your existing Segment account.

Set Up the Source

You need to configure both Source and Destination to import the data from somewhere into Treasure Data. In the example below, the source is a website and the destination is Treasure Data.

  1. Log in to Segment.

  2. Navigate to your Workspace.

  3. Navigate to Catalog > Sources

  4. Search and select the Javascript tile.

  5. Select Add Source.

  6. The Source setup dialog opens. Create a name, add labels and type in the URL for the website where you will install the tag. Select Add Source.

  7. Select Copy Snippet.


  8. Add the code snippet to your website.

Import Segment Data into Treasure Data

After setting up the source, you set up Treasure Data as the Destination.

  1. Navigate to Catalog > Destinations.

  2. Search and select Treasure Data.

  3. Select Configure Treasure Data.

  4. Select the source configuration created in the previous steps.


  5. The Treasure Data Settings dialog opens. Get your API write key from the TD Console.

  6. Paste the API Write Key and type in the name of the database where you want to import the data.

  7. Turn on the setting by selecting the on/off button.


Check the Source and Destination

  1. Visit your website to trigger the tracking code.

  2. Go to your Workspace in Segment and navigate to Destinations > Event Delivery.

  3. Check to see that the tracking tag is sending events to Segment.

  4. Open the TD Console.

  5. Navigate to Data Workbench > Databases.

  6. Search and select the destination database. The data can be seen in the pages table in that database.

  7. Optionally, check the import job in Jobs.


Query the Events

  1. Open the TD Console.

  2. Navigate to Data Workbench > Queries.

  3. Create a query in to track the events coming in.

  4. It might take a few minutes before events are logged in Treasure Data.

References

  • No labels