Hi Growthbook Team! How do I get the rule that is...
# announcements
s
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
What SDK are you using?
s
Hi @fresh-football-47124, I used
@growthbook/growthbook-react
The version is
0.13.0
f
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
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
Can you grab the feature payload JSON?
s
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
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
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
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