acoustic-actor-75733
04/15/2025, 9:00 PMambitious-noon-34894
04/16/2025, 5:42 AMcuddly-shampoo-71997
04/16/2025, 8:24 AM@growthbook/growthbook-react
here in docs https://docs.growthbook.io/lib/react#updating-attributes
gb.setAttributes({
// Only update the `url` attribute, keep the rest the same
...gb.getAttributes(),
url: "/new-page"
})
but I found that there is a method:
gb.updateAttributes()
it spreads previous attributes under the hood.
But it doesn't cover in docs. So probably it can be removed in next versions of SDK.
What will your recommendation?average-airport-34108
04/16/2025, 11:06 AMlemon-airline-30634
04/17/2025, 5:21 AMquaint-hairdresser-90717
04/17/2025, 9:25 AMDatasource ds_19g62cm9l5lhcb does not exist.
victorious-furniture-24530
04/17/2025, 3:32 PMGrowthbook SSE datasource","reason":"request failed: connection to server lost: EOF
I can't find any usage metrics in the UI, so cannot really determine what's happening. Any suggestions?microscopic-student-24852
04/17/2025, 4:07 PMlemon-airline-30634
04/18/2025, 10:42 AMrhythmic-piano-71371
04/19/2025, 3:19 PMpurple-art-11901
04/20/2025, 8:20 PMbroad-lamp-82546
04/21/2025, 11:48 PMhelpful-glass-76730
04/22/2025, 8:26 AMcolossal-jordan-70389
04/22/2025, 12:05 PMrapid-salesclerk-86901
04/22/2025, 4:15 PMmillions-pillow-33643
04/23/2025, 10:29 AMwide-beard-81045
04/23/2025, 10:48 AMbitter-salesclerk-96251
04/23/2025, 6:40 PMonReady() {
const { cartId, secureBaseUrl } = this.context;
let $body = $('body');
let $dropdown = $('#cart-preview-dropdown');
let visitor_id = localStorage.getItem("visitor_id");
if (!visitor_id) {
visitor_id = Math.random().toString(36).substring(2, 15);
// or any other method to generate a random ID
localStorage.setItem("visitor_id", visitor_id);
}
let pageType = this.context.page_type;
async function initializeGrowthBook() {
try {
// Manually fetch features
const response = await fetch(`<https://cdn.growthbook.io/api/features/sdk-z2eQdvHSoRomlSFH>`);
const { features } = await response.json();
// Initialize GrowthBook with the features
const pluginOptions = {
trackers: ["gtag"],
}
const gb = new GrowthBook({
enableDevMode: true,
features,
apiHost: "<https://cdn.growthbook.io>",
clientKey: "sdk-z2eQdvHSoRomlSFH",
plugins: [
thirdPartyTrackingPlugin(pluginOptions),
],
attributes: {
id: visitor_id, // Use the anonymous ID for user identification
}
});
let experiment_set = localStorage.getItem("experiment_key");
if (!experiment_set) {
let experimentKey = gb.isOn("groove-mini-cart");
localStorage.setItem("experiment_key", experimentKey);
if(pageType === 'product') {
window.location.reload();
}
}
if (gb.isOn("groove-mini-cart")) {
console.log("Feature enabled!");
$body.addClass('in-experiment');
$dropdown.addClass('cart-dropdown-gb');
cartPreviewGb(secureBaseUrl, cartId);
} else {
console.log("Feature disabled");
cartPreview(secureBaseUrl, cartId);
}
return gb; // Return the instance if needed elsewhere
} catch (error) {
console.error("Error initializing GrowthBook:", error);
}
}
microscopic-australia-657
04/23/2025, 8:13 PMworried-planet-2191
04/24/2025, 5:28 AMhigh-artist-59571
04/24/2025, 10:29 AMhigh-artist-59571
04/24/2025, 11:22 AM<http://xohi.com|xohi.com>
We’d really appreciate your advice on what steps remain to fully finalize the setup and ensure everything is running smoothly.
Are there any specific configurations or best practices we should be aware of at this stage?gorgeous-midnight-63327
04/25/2025, 11:20 PMgb. setAttributes ({
id: currentUser?._id ?? deviceld,
deviceld: deviceId,
utmSource: Cookie.get ('utm_source'),
utmMedium: Cookie.get ( 'utm_medium'),
utmCampaign: Cookie.get ('utm_campaign'),
utmContent: Cookie-get ('utm_content'),
}) ;
}, [currentUser, isInitializedl);
worried-planet-2191
04/28/2025, 3:13 PMboundless-mechanic-51341
04/29/2025, 3:46 AMAPP_ORIGIN
and API_HOST
env vars from default for our gateway setup - I think this is causing authentication to be enabled.
Thankscool-butcher-58862
04/29/2025, 11:04 AMcool-butcher-58862
04/29/2025, 11:05 AMcool-butcher-58862
04/29/2025, 11:06 AMwitty-carpet-85180
04/29/2025, 2:12 PMwindow
object. After the page loads, we create a React instance of GrowthBook using the payload and attributes from the window
instance.
However, our CRO specialist wants the window
instance removed. I attempted to destroy it using _growthbook.destroy()
, but it throws an error: Cannot delete property '_growthbook'
.
An alternative would be to inject the payload and attributes directly within the proxy, bypassing the window
object. However, I'm unsure whether redirect tests would still run as quickly as they currently do.
Do you have any recommendations / best practices / docs for this scenario?lemon-airline-30634
04/29/2025, 2:18 PM