https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
w

worried-businessperson-32427

11/07/2023, 3:45 PM
Problem firing event using PHP SDK My code is something like this:
Copy code
$trackingCallback = function (
    Growthbook\InlineExperiment $experiment,
    Growthbook\ExperimentResult $result
) {
    file_put_contents('/tmp/test.log', date("Y-m-d H:i:s") . ": " . "event fired!!!" . "\n", FILE_APPEND);
};

$growthbook = Growthbook::create()
    ->withTrackingCallback($trackingCallback);

$growthbook->loadFeatures("xxxxxxxx", "<https://cdn.growthbook.io>");

if ($growthbook->isOn("test-example")) {
    echo "Feature is enabled!";
} else {
    echo "Feature is NOT enabled!";
}
r

rhythmic-agent-34208

11/07/2023, 3:45 PM
@worried-businessperson-32427 has opened an issue Close Issue button
w

worried-businessperson-32427

11/07/2023, 3:46 PM
I would expect the event to be fired and write in the log file but nothing happens
Feature is enabled and experiment is running
b

brief-honey-45610

11/07/2023, 3:52 PM
Hi Dario, I'll take a look and get back to you as soon as I can. We've had a larger number of support requests today than usual so it may be a little while
w

worried-businessperson-32427

11/07/2023, 3:52 PM
👍
r

rhythmic-agent-34208

11/09/2023, 1:24 AM
Hi Dario, it looks like the ID and/oror attribute information isn't being provided in the trackingCallback in the code snippet you sent. Note the example in the first code block here: https://docs.growthbook.io/lib/php#quick-usage
w

worried-businessperson-32427

11/14/2023, 9:15 AM
Thanks! I added the ID and now it's working! ;-)
b

brief-honey-45610

11/14/2023, 3:18 PM
Fantastic!
2 Views