Hello, I’m just beginning with GB and here’s what ...
# ask-questions
Hello, I’m just beginning with GB and here’s what I have done so far.
Copy code
define("FEATURES_ENDPOINT", '<https://cdn.growthbook.io/api/features/key_prod_5926******fdba>');
$apiResponse = json_decode(file_get_contents(FEATURES_ENDPOINT), true);
$features = $apiResponse["features"];

// generate 100 fake requests and allow specific feature based on ID attribute.
for($i = 0; $i<100; $i++) {
    $growthbook = Growthbook::create()
            'id' => rand(1, 100)
    if ($growthbook->isOn("test-feature-ab")) {
        echo "It's on! <br>";
    } else {
        echo "It's off :( <br>";
Its working fine, I’m getting
for specific set of users and its totally random. now, the question is that how can I feed those On/Off to the experiments, so that I can get report and statistics. Note: I’m using PHP SDK.
Hi. You would need to store those assignment events (along with conversion metrics) in a database so GrowthBook can query the data.
This is usually done by using an analytics event tracking system like Segment, Mixpanel, or Snowplow.
In our case we’re using google analytics for tracking. so we need to push those experiments data to google analytics first in order to get the report and statistics. is it so? code would be something like this.
Yes. Are you using the older Universal Analytics or GA4?
We’re using Universal Analytics.
Ok, then yes the example you posted should work.
👍 1