To get the most out of tools like LaunchDarkly, you'll need to create user segments so that features can be toggled on for specific customers when the time is right. LaunchDarkly supports two segmentation methods:
Targeting individual users for inclusion or exclusion (for example, enable or disable a feature for user #123)
Targeting all users who satisfy an attribute-based rule (for example, enable a feature for all users located in Germany)
Both of these methods are limited by the fact that LaunchDarkly can't read user attributes directly from your data warehouse or production database. Instead, LaunchDarkly relies on developers to send user data via the SDK during feature flag evaluation. This is problematic in many common scenarios. For example, you might want to segment users based on attributes that are simply not possible to compute in real time (for example, historical usage metrics that require aggregating across large volumes of data).
LaunchDarkly has a limited view of your customers. Hightouch solves this problem by letting you define your user segments on top of your data warehouse or production database. This ensures that your LaunchDarkly segments will always remain in sync with your entire data stack. Feature flags work best when they share a single source of truth with the rest of your business.
We use LaunchDarkly at Hightouch. We built this destination for ourselves, and we think you'll love it too.
You can do more complex segmentation by leveraging all the data in your warehouse, including event data and third-party data. Your warehouse is the only place where all of this data coexists.
You can keep your LaunchDarkly segments in sync with the rest of your business tools. For example, you might want to send an email newsletter to users who've been invited to a beta program. You also might want to sync these attributes to a CRM like Salesforce or HubSpot. Hightouch integrates with 100+ SaaS tools used for email marketing, customer support, sales, and more. Define your audience once and activate your data everywhere.
You don't have to send any sensitive user data to LaunchDarkly. Hightouch determines which users are part of your segment and only transmits the bare minimum information necessary for targeting (usually just a user ID).
Segments can be defined using the tools that your teams are most comfortable with. You can filter and transform data from your warehouse using SQL or our visual query builder—whichever you prefer. (You can even create LaunchDarkly segments based on work you've already done in dbt or Looker!)
Hightouch can sync data to a LaunchDarkly segment in three ways:
Target users for inclusion
Target users for exclusion
Target users who match a custom rule
We recommend targeting individual users for inclusion/exclusion if LaunchDarkly's feature flagging only affects your application's frontend experience. However, if you intend on feature flagging backend functionality that applies to entire organizations (instead of specific users), it might be better to use rule-based targeting. This is because certain backend logic often can't be associated with an individual application "user" in the traditional sense. Chat with us if you're not sure which approach to take.
The most common way of using our LaunchDarkly destination is to sync a model containing a list of user IDs for inclusion or exclusion in a particular segment.
In your sync configuration, simply tell Hightouch which field from your model represents the user identifier known to LaunchDarkly.
Sometimes, you might want to sync different users to inclusion and exclusion lists for the same LaunchDarkly segment. This can be accomplished by configuring two separate syncs in Hightouch.
Hightouch can also sync your data into a LaunchDarkly rule clause.
Suppose you have a list of email addresses belonging to your sales prospects. You want to immediately enable a feature as soon as they sign up for a trial account. However, you can't predict their user IDs before they've created their accounts. How would you add them to your LaunchDarkly segment in advance?
This scenario is perfect for rule-based segmentation. Your rule clause might look something like this.
Simply create a model that returns a list of email addresses. Then, in your sync configuration, point Hightouch to the desired rule clause. Your LaunchDarkly segment will automatically mirror your Hightouch model. As new email addresses appear, they will be added to the rule clause. The opposite is also true: as email addresses disappear, they will be removed from the rule clause. Simple, right?
Hightouch can't create new rules on your behalf, so rule-based targeting
requires you to initially create each rule inside of the LaunchDarkly web app.
Give your token a name and assign it the Writer role
Click Save token and copy the new token that appears in the Authorization page
We recommend using a service token if your LaunchDarkly account is on the
Enterprise plan. To do this, simply select This is a service token while
creating the token. If you're not on the Enterprise plan, just be mindful that
your API token will get revoked (and your Hightouch syncs will fail) if your
personal LaunchDarkly account is deactivated for any reason.
Log in to Hightouch or create a free Hightouch account
Click on Destinations in the left sidebar
Click on Add destination in the top right corner
Select LaunchDarkly in the destination catalog and click Continue to proceed
Paste your API token into the API Access Token field and click Continue to proceed
Give your destination a name and unique slug (for example, “LaunchDarkly Production” and launchdarkly-production)
Click Finish to create your LaunchDarkly destination.
Now that we've linked Hightouch to your LaunchDarkly account, it's time to connect to build user segments using the data that resides in your data warehouse.
Hightouch sits on top of your data warehouse and can read from Snowflake, Redshift, BigQuery, Databricks, Postgres, MySQL, and many other data sources. You can even fetch data from Google Sheets and Airtable. Hightouch can help activate your data wherever it resides.
We've written dedicated guides for each supported data source. Take your pick:
If you're missing the credentials necessary to connect to your data source,
try inviting your teammates to Hightouch. You can have unlimited collaborators
in your workspace.
Waiting for credentials to your data warehouse? No problem. You can connect to one of our sample databases to get started right away. For the rest of this tutorial, we'll use our demo Postgres database, which contains a users table with names, emails, locations, and other user attributes. This sample source is available when you log in for the first time—no setup required.
Next, we'll write a SQL query to define which users should be synced to our LaunchDarkly segment.
In Hightouch, a model represents a query that filters or transforms the records in your data source. Models are used to determine exactly which records to sync between sources and destinations.
When you connect to a data warehouse, your models will probably be written in SQL. You can also import models from tools like dbt and Looker.
In this example, we'll keep it simple. Suppose you want to use LaunchDarkly to enable a feature only for your customers located in the city of Nashville. To accomplish this, you'll want to create a model that looks like this:
SELECT*FROM users WHERE location ='Nashville';
Click on Models in the left sidebar
Click on Add model in the top right corner
Select Demo Database as your source and click Continue to proceed
Select SQL Editor as your modeling method
Paste the SQL query from above into the editor on the left side of the page
Click Preview to execute the query
Click Continue to proceed
Give your model a name and unique slug (for example, "Users in Nashville" and users-in-nashville)
Select ID as the primary key for your model
Click Finish to create your model.
We just created a model using a SQL query that filters our users table down to only those located in Nashville. Next, we'll configure our sync to add these users to a LaunchDarkly segment.
Make sure you've configured your sync to use the correct LaunchDarkly environment. You might've accidentally pointed to a different environment. If that doesn't solve your issue, . We're happy to help. We're happy to help.
Hightouch provides complete visibility into the API calls made during each of your sync runs. We recommend reading our article on debugging tips and tricks to learn more.