Skip to main content

Heap Analytics

You can integrate Flagsmith with Heap Analytics. The integration automatically sends the flag states for identified users into Heap for cohort analysis, A/B testing and more. The process is as follows:

Integration Setup

  1. Get the Heap Project Environment ID for your Heap project from the Heap Manage Project page (Account > Manage > Projects > Environment > Get ID)
  2. Add the ID key into Flagsmith (Integrations > Add Heap Integration)
  3. All API calls generated by the Flagsmith SDK to the Get Identity Flags endpoint will send the a full set of flag evaluations for that particular user to Heap as an Event

How it Works

tip

For flags that contain remote config values, Flagsmith will pass the value of the flag to Heap if the flag is enabled.

If the flag has no remote config value, Flagsmith will just pass the boolean state for the flag.

Identity flag values are passed into Heap. If we make the call to the Flagsmith API to get the flags for an Identity.

curl 'https://edge.api.flagsmith.com/api/v1/identities/?identifier=development_user_123456' \
-H 'x-environment-key: 8KzETdDeMY7xkqkSkY3Gsg'

And then take a look in our Heap dashboard, you can see the user and the flag data that has been sent to the Heap platform.

Heap Analytics

Use Case

Once the integration has been set up, you can start segmenting your Heap identities based on the flags that they saw.

This means you can run AB tests driven by Flagsmith segments, and have the data show up automatically in Heap.

Running Multivariate Tests with Heap and Flagsmith

Once your integration has been set up and has been running for a few days, you will see flag values appear in Heap as "Custom Event Properties" as child properties of the "Flagsmith Feature Flags" event. Here's how you can see the effectiveness of a flag being enabled. We're going to use an example of our own platform, where people can toggle the "Dark Mode" flag within our application on and off.

Step 1 - Create a Custom Event Definition

In Heap, go to Definitions > New Definition > New Event. Set up your event similar to the below:

Heap Analytics Step 1

Step 2 - Create a Segment based on this new Custom Event Property

In Heap, go to Definitions > New Definition > New Segment. Set up your Segment similar to the below:

Heap Analytics Step 2

Step 3 - Create your Report

Once you have your Segment created, based on a Flagsmith flag value, you can use that Segment in reports within Heap. Here's an example of us seeing what the conversion rate of a dark mode vs non-dark mode user looks like. Notice the "Group Analysis - Conversion Rate" at the bottom of the page.

Heap Analytics Step 3

Integration Notes

You have to identify users on both platforms in the same way. The Flagsmith Identity ID must be the same as the Heap identity.