refined-rose-14039
12/20/2024, 4:07 PMrefined-rose-14039
12/20/2024, 4:08 PMconst gb = new GrowthBook({
apiHost: "<https://cdn.growthbook.io>",
clientKey: "### I confirmed this is correct",
// Enable easier debugging during development
enableDevMode: true,
// Update the instance in realtime as features change in GrowthBook
subscribeToChanges: true,
// Targeting attributes
attributes: {
},
// 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");
// the objective is to create a feature or experiment that puts customers into a 50/50 experiment where
// half of customers will see a viewing experience enabled by the existence of the class name "in-experiment"
// and the other half of customers see a viewing experience where "in-experiment" is not applied.
if (gb.isOn("groove-mini-cart")) {
const miniCartChange = gb.getFeatureValue("groove-mini-cart");
console.log(miniCartChange, 'Create change?');
if (miniCartChange == true) {
$('body').addClass('in-experiment');
}
}
}
initializeGrowthBook(); // Call the async function
console.log(gb);
refined-rose-14039
12/20/2024, 4:09 PMrefined-rose-14039
12/20/2024, 4:09 PMfresh-football-47124
fresh-football-47124
fresh-football-47124
refined-rose-14039
12/20/2024, 7:22 PM