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

sparse-guitar-91772

03/16/2023, 7:56 AM
Hi Growthbook Team! How do I get the rule that is used from
onFeatureUsage
callback? For example, I have 3 rules as below, the first two are force rules, and the last one is for A/B experiments. I have tried several times but it seems
ruleId
is not working...
🙏 1
Screen Shot 2023-03-16 at 3.57.10 PM.png
f

fresh-football-47124

03/16/2023, 8:01 AM
What SDK are you using?
s

sparse-guitar-91772

03/16/2023, 8:03 AM
Hi @fresh-football-47124, I used
@growthbook/growthbook-react
The version is
0.13.0
f

fresh-football-47124

03/16/2023, 8:11 AM
I wonder if the method isn’t calling
evalFeature
what method are you calling?
onFeatureUsage?
1
oh, prob not: “The
result
argument is the same thing returned from
gb.evalFeature
.”
😂 1
s

sparse-guitar-91772

03/16/2023, 8:13 AM
Yes, I use
onFeatureUsage
and want to do some statistics on our own Kibana platform.
I read it from your official documentation
However, the
ruleId
is empty no matter how...
f

fresh-football-47124

03/16/2023, 8:25 AM
Can you grab the feature payload JSON?
s

sparse-guitar-91772

03/16/2023, 8:31 AM
Do you mean the response for
<https://cdn.growthbook.io/api/features/SDK-id>
API request?
I got this ⬇️
Seems like I don't have
id
field for each rule object, do you know how to set it?
f

fresh-football-47124

03/16/2023, 8:47 AM
ya, I see that - let me open a ticket with the team on this
the SDK has it as optional
are you using the legacy SDK or the new one?
s

sparse-guitar-91772

03/16/2023, 8:49 AM
Hi @fresh-football-47124 I also found another bug
I think it should be the latest one, will check later
Issue: the
source
value is incorrect Reproduce Steps: 1. Set some force rules 2. Use them in the code, the experiment result will fall into one of the force rules. 3. Check the
result
data from
onFeatureUsage
callback Expected Results:
result.source = '_force_'
Actual Results:
result.source = 'experiment'
I found this issue thanks to GrowthBook Chrome Extension:
@fresh-football-47124 Yes, the latest one
f

fresh-football-47124

03/16/2023, 8:57 AM
I’ll follow up when I have a chance to sync with the team
❤️ 1
That last one doesn’t sound right - but let me make a test case
👍 1
I think I can reproduce that
👍 1
I’ll share my example code with the team, perhaps I’m just not understanding ‘force’ there - perhaps we mean it to mean a rule as been applied
s

sparse-guitar-91772

03/16/2023, 9:29 AM
2 Views