https://www.growthbook.io/ logo
b

brave-agent-21457

09/15/2023, 4:58 AM
Hi Team I am integrating Growthboon into the WordPress plugin. I am getting this error:
Copy code
Must set an HTTP Client before loading features.
It's because we using managed shared hosting and it dies not have PSR HTTP client Unfortunately this can not be enable on the managed shared hosting. What's the other option to use it in the PHP/WordPress ?
h

happy-autumn-40938

09/15/2023, 5:10 AM
If you want to fetch dynamic features from the GrowthBook server then your PHP config must be set up to perform HTTP fetching. (You'll also run into a similar issue if you want to fire any analytics tracking callbacks). However, if you are ok with pre-baked (permanent) feature definitions, you can manually set them in code: https://docs.growthbook.io/lib/php#withfeatures-method Alternatively (additionally?), you could look into front-end tests using JavaScript.
b

brave-agent-21457

09/15/2023, 5:10 AM
I want to use this for AB test
h

happy-autumn-40938

09/15/2023, 5:13 AM
Typically features can reference AB test experiments. However, you can also set manual (hard-coded) experiments: https://docs.growthbook.io/lib/php#inline-experiments
if your AB Test experiments are front-end specific (i.e. visual editor or similar), you can just use the JavaScript SDK if you like
b

brave-agent-21457

09/15/2023, 5:16 AM
It's backend related
So it will split into 50%-50% ?
I tried this, I am always getting the first item from the given set
h

happy-autumn-40938

09/15/2023, 5:33 AM
You can choose the number of variations and the split percentages as you see fit. You will need to provide a unique user id (ex: sessionId) to the SDK in order to randomize the variation. The bucketing is deterministic (users always stay within their assigned variation)
b

brave-agent-21457

09/15/2023, 5:35 AM
So will it store something to files to get the correct value after applying the percentage?
Or it is juts a random?
h

happy-autumn-40938

09/15/2023, 5:38 AM
nope, it's deterministic hashing which always results in the same variation for any specific user id.
b

brave-agent-21457

09/15/2023, 5:53 AM
got it.
And it run locally so no api call needed to Growthbok ?
h

happy-autumn-40938

09/15/2023, 6:29 AM
Correct, assuming you’re ok with manually setting the experiment definition
b

brave-agent-21457

09/15/2023, 2:26 PM
yes thanks it helped me a lot as we are using WP engine and the HTTP client is disabled there.
🙌 1