Skip to content

Commit

Permalink
chore: generate test link
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienne-deriv committed Sep 24, 2024
1 parent be1724f commit d28a2d8
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 156 deletions.
9 changes: 6 additions & 3 deletions src/javascript/_common/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const Analytics = (() => {
const init = () => {
if (process.env.RUDDERSTACK_KEY && process.env.GROWTHBOOK_CLIENT_KEY && process.env.GROWTHBOOK_DECRYPTION_KEY) {
DerivAnalytics.Analytics.initialise({
growthbookKey: process.env.GROWTHBOOK_CLIENT_KEY, // optional key to enable A/B tests
growthbookKey : process.env.GROWTHBOOK_CLIENT_KEY, // optional key to enable A/B tests
growthbookDecryptionKey: process.env.GROWTHBOOK_DECRYPTION_KEY, // optional key to enable A/B tests
rudderstackKey: process.env.RUDDERSTACK_KEY,
rudderstackKey : process.env.RUDDERSTACK_KEY,
});
}
};
Expand All @@ -21,15 +21,18 @@ const Analytics = (() => {
if (DerivAnalytics.Analytics?.getInstances()?.ab) {
return [DerivAnalytics.Analytics?.getFeatureValue(featureFlag, resolvedDefaultValue), true];
}

return null;
};

const setGrowthbookOnChange = onChange => {
const isGBLoaded = isGrowthbookLoaded();
if (!isGBLoaded) return null;

DerivAnalytics.Analytics?.getInstances().ab.GrowthBook?.setRenderer(() => {
const onChangeRenderer = DerivAnalytics.Analytics?.getInstances().ab.GrowthBook?.setRenderer(() => {
onChange?.();
});
return onChangeRenderer;
};

return {
Expand Down
Loading

0 comments on commit d28a2d8

Please sign in to comment.