refined-rose-14039
10/02/2024, 7:40 PMconst gb = new GrowthBook({
apiHost: "<https://cdn.growthbook.io>",
clientKey: "sdk-z2eQdvHSoRomlSFH",
// Enable easier debugging during development
enableDevMode: true,
// Update the instance in realtime as features change in GrowthBook
subscribeToChanges: true,
// Targeting attributes
attributes: {
id: "123",
country: "US",
},
// Only required for A/B testing
// Called every time a user is put into an experiment
trackingCallback: (experiment, result) => {
console.log("Experiment Viewed", {
experimentId: experiment.key,
variationId: result.key,
});
},
});
// Use an async function to initialize GrowthBook
async function initializeGrowthBook() {
// Download features and experiments from the CDN
await gb.init();
console.log("GrowthBook initialized");
}
initializeGrowthBook(); // Call the async function
console.log(gb);
if (gb.isOn("my-feature")) {
console.log("Feature enabled!");
}
fresh-football-47124
fresh-football-47124
fresh-football-47124
"variations": [true, true, false],
fresh-football-47124
fresh-football-47124
refined-rose-14039
10/03/2024, 1:47 PMrefined-rose-14039
10/03/2024, 5:37 PMrefined-rose-14039
10/03/2024, 5:37 PM