Segment

On This Page

Adding a Segment Integration in Variance

Segment is the easiest way to get your customer data into Variance. Hooking up Segment is easy. To start, head to the Integrations page in Variance.

You'll find integrations under your company name in the top nav

Then you'll Add a Segment Connection. You can describe it in any way you want, but we suggest using the name of the Segment source you're going to be piping from. We recommend you use one connection per source, as you can then filter by source, but it's up to you. As part of the setup you'll also be asked for your Account Mapping preferences. This outlines how you include Account information on your Segment `identify` calls. You can find lots more detail on this in our Account Mapping section.

Name your integration and (only the first time) tell us how you identify the company

Once you've added the integration you'll see two pieces of data:

  1. Webhook URL
  2. Secret
Hooking Segment up is a breeze

Account Mapping from Segment to Variance

On the first time you connect a Segment integration we ask for a little bit of additional information about you how link users with their companies in your Segment data. We support whatever way you currently manage things:

  1. Group: if you already use the Group call to indicate the Account, then you don’t need to fill in anything. We will extract the Account automatically, and you’re good to go.
  2. Identify with custom traits (ex. `company.id` and `company.name`): choose this option if you include some information about the Account/Company/Organization as a trait in each Identify call. When you choose this option you'll need to let us know the name of the trait you use. For instance, if you do something like `{'company':{'id':1,'name':'Awesome Inc.'}}` you could add `company.id` as the Account ID trait and `company.name` as the Account Name trait.
  3. (Fallback) Identify email trait domain extraction: if you don't use either of the methods above, we can extract the domain from the `email` trait and use that as the Account name.

If you aren't sure how you do account mapping now, you can check your Segment debugger (we're happy to help as well). If none of these work for you or you have any questions at all, please reach out and we're happy to hop on a Zoom and help you get set up.

Connecting the Variance Destination in Segmentt

The very best method for connecting Variance up as a Segment destination is to use the official Segment Destinations catalog. Simply follow these steps:

  1. From the Destinations catalog page in the Segment App, click Add Destination.
  2. Search for "Variance" in the Destinations Catalog, and select the "Variance" destination.
  3. Choose which Source should send data to the "Variance" destination.
  4. Go to the Variance Integrations page (you'll see it in the main nav under your company name).
  5. Click Add Connection.
  6. Give your connection a name (descriptive is better as it can be used as an event filter in Variance).
  7. Choose a method for account matching. Details on these methods can be found in the Account Mapping section.
  8. Find and copy the "Secret" and "Webhook URL" fields associated with this project.
  9. Back in the Segment App, enter these as the "API Key" and "Webhook URL" fields in the "Variance" Destination settings.

That's it. You should be good to go.

Connecting Variance as a Webhook Destination in Segment

If, for some reason, you prefer to set Variance up as a Webhook destination, that is possible as well (though not recommended). To set it up, head over to Segment, choose the Source you are piping from and then click Add Destination.

There's the Add Destination button in case you miss it.

From the Destinations catalog you want to choose the Webhooks destination.

Webhooks all the way down

That will bring you to the configuration screen. Here you'll enter the two pieces of data we gave you.

First, under Connection Settings you'll see Webhooks (max 5). Click that and enter the Webhook URL we gave you and hit Save.

Add the Webhook URL and click Save

Now under Other Settings add your Shared Secret and hit Save.

Almost done

Alright. That's it. Just two bits of data and we're all set. There's one more really important step: turn on the integration by flipping the switch. Make sure to do this or we won't receive any data.

Flip the switch!

Alright, that's it. If you want to check the status, just create some events in the source and they should flow through Segment to Variance. If you have any problems let us know.

Grabbing Your Identify Structure

If you aren't sure what properties you're using for identifying accounts, it's easy to go into the Segment debugger to to find the payload of a recent `identify` call.

  1. Go to your Segment Workspace
  2. Find the Source you want to connect to Variance
  3. Click Debugger in the Source nav
  4. Click Advanced
  5. Uncheck everything except Identify
Finding your identify calls is easy in the Segment Debugger

From there you should see a number of Identify calls. Just click into one (that doesn't say anonymous) and it should look something like this:

analytics.identify('1234567-ABCD-9876', {
  company.name: 'Variance, Inc.',
  company.id: '123-ABC',
  email: 'name@company.com',
  firstName: 'Noah',
  lastName: 'Brier',
  name: 'Noah Brier',
  role: 'OWNER',
});

You'll see within that call that the company is being identified with `company.name' and 'company.id'. We will use these to do account matching.

Last Updated: 
July 23, 2021