How to set up the Segment integration
In this guide you’ll learn how to set up a Segment integration and add conversational data to your analytics stack.
Create a source
In Segment, a source represents a website or app that you want to track. Sources send data into Segment, while destinations receive data from Segment.
Let’s create a source and connect it to your app.
- In Segment, click Catalog, then search for HTTP API in the search box. Click on HTTP API when the search result appears.
In the pop-up window, click Add Source.
Give the source a descriptive name, such as
Click Add Source.
A new screen will appear with your source’s Write Key. Make a note of this value. Leave this tab open in your browser since you’ll come back here to test the connection.
You can always access the Write Key by opening the source, choosing the Settings tab, then selecting API Keys from the left-hand menu:
Create the integration
Now that you have your Segment write key, you’re ready to add the integration to your app.
- In your app’s root folder, create a file called
vault.yaml, if it doesn’t already exist, and add the following line:
Do not place your actual write key in this file. The
vault.yamlfile tells developers what private data they need to include in
Save the file.
- In your app’s root folder, create a file called vault.secret.yaml, if it doesn’t already exist, and add this:
Make sure to replace
WRITE_KEYwith your source’s write key you generated in the previous section.
Upload the new secrets to your vault by running this command in your terminal:
meya vault upload --file vault.secret.yaml
- In your app’s root folder, create a folder called
integrations, if it doesn’t already exist. Inside, create a file called
segment.yaml. Copy this code into the file:
type: meya.segment.integration write_key: (@ vault.segment.write_key )
Save the file, then run these commands in your terminal to push your changes to the Grid:
meya format meya push
Test the integration
- Go to your new source’s page in Segment. Click the Debugger tab.
- Open the Meya console in your browser and go to the Simulator tab. Enter any text, then check the Segment debugger. You should see at least one event come in.
You now have an integration with Segment and are ready to start connecting your source to any number of destinations!
Updated 7 months ago