Tracking Observability
Inspector Segment integration

Send data from Segment to Avo Inspector (no code needed)

Use Avo Inspector as a Segment destination

If you are already sending your data to Segment you can stream it to Avo Inspector without adding any code to your codebase.

You'll need to create a Segment Destination powered by Segment Function with a code snippet provided in your Avo workspace for each app and environment combination.

In Segment you usually have different sources for each app environment, for example if you have a single web app, you probably have Web App Dev and Web App Production sources in Segment.

Unlike Segment, Avo sources contain environments in them, so you will only need to create an Avo source per app, in our example you'll need a single Avo source called Web App.

After connecting your Segment Source to corresponding code snippet the event schemas of all events seen in Segment will automatically be sent to Avo Inspector and you'll be able to monitor the quality of your tracking implementation without any changes in your code!

Remember that production data takes up to 2 hours to appear in Inspector dashboard, while development data is available without any delay

Diagram of the data flow when sending directly to Segment

This is the use case when you are not generating code with Avo.

You send data directly to Segment and it notifies Avo Inspector about your tracking plan taxonomy.

Data flow from Segment to Avo Inspector

If you are using Avo Codegen and Avo generated code, see diagram of the data flow when using Avo Codegen.

Guide to connect Segment and Avo Inspector

Create an Avo source to get the code snippets for your Segment integration

Step 1. Set up your Avo source

An Avo Source is the first thing you need to connect your Segment data to Avo Inspector.

Open Sources in the Avo sidebar or Manage Sources in Inspector tab

Navigation to Inspector sources screen in Avo

If you already have the source, pick it. If you don’t have the source corresponding to your app, add a new one.

Image of the Add Source button in Avo

In the source details, go to "Inspector Setup" and there you’ll see options to integrate Inspector. Pick Segment to see the integration code snippets.

Source settings in Avo

Use the copy button to copy the full snippet to clipboard when you need to paste them into Segment on the next step.

Development and production code snippets to integrate with Inspector

Step 2. Create Segment destinations with the provided code snippets

Open Segment and log in into your workspace.

Go to Connections -> Catalog -> Functions in Segment.

Segment navigation to the functions menu

And press the + New Function button

Segment button to create a function

We are interested in a destination function.

Segment create destination screen

After creating a destination function you’ll find yourself in the web code editor provided by Segment. Here you would paste one of the code snippets we’ve seen in Avo on the 1st step. You'll need to create 2 separate segment functions for each code snippet, one for development and one for production.

Example of code snippet in the Segment UI

Save it by pressing Configure in the right bottom corner, filling the info in the next screen and pressing Create Function.

Segment create function modal

Create 2 separate Segment functions for development and production environments

Step 3. Test your development Segment Function (Optional)

You can test the production Segment function in the same way, but keep in mind that the production data shows with a ~2 hours delay in Inspector dashboard, while development data is shown without delay

If you press “Use Sample Event” you’ll be able to pick one of the existing events that Segment saw in your workspace before.

Segment pick sample event modal

Pick an event. Keep in mind that the reused Segment event will have the same timestamp as when it was originally fired, so we recommend to pick a recent event.

Press Run in the top right corner. The request will be executed. The result in Segment should look similar to this:

Segment success output of the test run of the function

Then navigate to Avo, Inspector and pick Development environment

Environment picker in Inspector

And you’ll see the event in your dashboard under the source from where you got the snippet from. If you reused an old event from Segment you may need to switch to the 30 days time window in Inspector.

Source overview in Inspector

This means that the Segment function is working.

Step 4. Connect the Segment Functions to your Segment Sources

Go back to Connections -> Catalog -> Functions in Segment. Pick the newly created Segment function and choose + Connect Destination in the sidebar.

Connect destination button in the Segment UI

Pick a source that would be analyzed by Avo Inspector and press Confirm Source in the top right corner. Double check that you source and destination environments match.

Picking a source for the destination function in Segment UI

Make sure to enable the destination using the toggle in the next screen

Enabling a destination in Segment

Now your Segment events stream to this source is analyzed by Avo Inspector.

Connect both development and production Segment Functions to your development and production Segment Sources.

Diagram of the data flow when sending to Segment with Avo generated code

This is the use case when you generate code with Avo.

You have an Avo file, represented by an Avo Source, in your codebase and send data to Segment with it. Then Segment notifies Avo Inspector about your tracking plan taxonomy.

Data flow from Segment to Avo Inspector with Avo Codegen

Billing

Segment functions are billed by execution time. Learn the details here (opens in a new tab)