Skip to content

Commit

Permalink
Stringify experiments object for segment (#14960)
Browse files Browse the repository at this point in the history
  • Loading branch information
timroes committed Jul 26, 2022
1 parent 4963698 commit 2698151
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const LDInitializationWrapper: React.FC<{ apiKey: string }> = ({ children, apiKe
// The LaunchDarkly promise resolved before the timeout, so we're good to use LD.
setState("initialized");
// Make sure enabled experiments are added to each analytics event
addAnalyticsContext({ experiments: ldClient.current?.allFlags() });
addAnalyticsContext({ experiments: JSON.stringify(ldClient.current?.allFlags()) });
// Check for overwritten i18n messages
updateI18nMessages();
updateFeatureOverwrites(ldClient.current?.variation(FEATURE_FLAG_EXPERIMENT, ""));
Expand All @@ -118,7 +118,7 @@ const LDInitializationWrapper: React.FC<{ apiKey: string }> = ({ children, apiKe
useEffectOnce(() => {
const onFeatureFlagsChanged = () => {
// Update analytics context whenever a flag changes
addAnalyticsContext({ experiments: ldClient.current?.allFlags() });
addAnalyticsContext({ experiments: JSON.stringify(ldClient.current?.allFlags()) });
// Check for overwritten i18n messages
updateI18nMessages();
};
Expand Down

0 comments on commit 2698151

Please sign in to comment.