Skip to main content
Version: Config V1 (legacy)

Amplitude - Add feature flag changes to your charts

Overview

There are two available integration oppurtunities between ConfigCat and Amplitude:

Monitoring your feature flag change events in Amplitude with Annotations

Every feature flag change in ConfigCat is annotated on the Amplitude charts as a vertical line and some details are added automatically about the change.

amplitude_chart

Installation

  1. Have an Amplitude subscription.
  2. Get an Amplitude API Key and Secret Key. amplitude_apikey_secretkey
  3. Open the integrations tab on ConfigCat Dashboard.
  4. Click on Amplitude's CONNECT button and set your Amplitude API key and Secret key.
  5. You're all set. Go ahead and make some changes on your feature flags then check your charts in Amplitude.

Un-installation

  1. Open the integrations tab on ConfigCat Dashboard.
  2. Click on Amplitude's DISCONNECT button.

Chart Annotation

Every annotation sent to Amplitude by ConfigCat has:

  • Name: A brief summary of the change.
  • Description: A direct link to the Product/Config/Environment of the feature flag in ConfigCat.
amplitude_annoation

Sending feature flag evaluation analytics to Amplitude Experiments

Ensures that feature flag evaluations are logged into Amplitude Experiments. With this integration, you can have advanced analytics about your feature flag usages, A/B test results.

Setup

  1. Install SDKs: Add both the ConfigCat SDK and Amplitude SDK to your application.
  2. Configure SDKs:
    • ConfigCat SDK: Initialize with your ConfigCat SDK key.
    • Amplitude SDK: Set up with your Amplitude ApiKey.
  3. Integrate Feature Flag Evaluations:
    • During the initialization of the ConfigCat SDK, subscribe to the flagEvaluated hook.
    • Send feature flag evaluation data to Amplitude using the $exposure event name. Include the following parameter:
      • flag_key: the feature flag's key.
      • variant: the evaluated feature flag's value or variation ID
      • variation_id (optional): the evaluated feature flag's variation ID
    • You can use the Identify API in Amplitude to enrich all your events with feature flag metadata. This way you can easily group/filter your existing Amplitude events by feature flag evaluations.

Code samples:

const configCatClient = configcat.getClient("#YOUR_SDK_KEY", PollingMode.AutoPoll, {
setupHooks: (hooks) =>
hooks.on('flagEvaluated', evaluationDetails => {
// Send an `$exposure` event.
amplitude.track('$exposure',
{
'flag_key': evaluationDetails.key,
'variant': evaluationDetails.value,
'variation_id': evaluationDetails.variationId
});

// Use the identify API.
const identifyEvent = new amplitude.Identify();
identifyEvent.set("configcat_" + evaluationDetails.key, evaluationDetails.value);
amplitude.identify(identifyEvent);
}),
});
note

For Text feature flags with lengthy values (e.g., JSON), send the variationId instead of the value as the variant to Amplitude. The variationId is a hashed version of the feature flag value, accessible on the ConfigCat Dashboard by enabling the Show VariationIDs to support A/B testing setting. Learn more here.

  1. Deploy your application and wait for feature flag evaluations to happen so Experiments in Amplitude could be populated.

Usage with Experiments

Check your Experiments page in Amplitude and select your feature flag as the Experiment.

Usage with custom chart

If you don't have access to the Experiments feature in Amplitude, you can create a custom chart based on the Exposure event. You can filter for your feature flag keys with the Flag Key property and visualize the different variants by using the Variant property as a Breakdown. Example:

Amplitude custom chart

Usage with enriched user properties for your custom events.

If you use the Identify API approach, you'll be able to use the feature flag evaluation data in your current reports. You can Group Segments by your feature flag evaluations:

Amplitude chart with enriched data