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

incalculable-yacht-10590

09/25/2023, 8:17 AM
hi guys, i have a question related growthbook can i do like this, let's say i passing
id = 5
, and then growthbook query to postgres (data source) to decide
id = 5
will treat as experiment or control?
w

white-fireman-22476

09/25/2023, 8:29 AM
Yes. Just make an experiment where the assignment attribute is id.
i

incalculable-yacht-10590

09/25/2023, 9:06 AM
hmm how i can pass it and query based on that attributes ya?, i already implement SDK and set the attribute, but on growthbook side i only see this, which one i need to choose ya?
w

white-fireman-22476

09/25/2023, 9:59 AM
Add A/B experiment.
i

incalculable-yacht-10590

09/25/2023, 11:47 AM
and which part i can add my query to decide the id treat as control / experiment
w

white-fireman-22476

09/25/2023, 12:11 PM
assign value based on attribute... it looks like it is already set to id.
i

incalculable-yacht-10590

09/26/2023, 1:38 AM
hmm but on that part, how i can put my raw query ya?, i can't find it
h

happy-autumn-40938

09/26/2023, 4:33 AM
Variation assignment is done on-the-fly using deterministic hashing at the SDK level; yours is configured to hash using the
id
field. If you want to track actual assignment events, you'll need to use the SDK's
trackingCallback
to log the user's assignment (and their attributes) to a warehouse.
i

incalculable-yacht-10590

09/26/2023, 6:00 AM
if i not use growthbook variation assignment, and use id_tail to assignment its possible?
h

happy-autumn-40938

09/26/2023, 6:17 AM
I believe you'd need to rig up a forced variation based on a new "forcedBucket" attribute. Then you'd need to pass forcedBucket into your attributes in the SDK. Something like...
Copy code
const forcedBucket = await getBucketByUserId(id);

gb.setAttributes({
  forcedBucket,
  etc...
});
...or bake the value of forcedBucket into your template. Either way, it would be some sort of DB lookup under the hood. Also note that doing your own bucketing limits your ability to control the test rollout using GrowthBook.
w

white-fireman-22476

09/26/2023, 7:19 AM
It is also possible that perhaps you want to use GB bucketing but just have a different id that you want to identify your users by and hash your experiments by. In that case you can set a new identifier type on your Metrics and Data> Data Sources > your data source page. Then set a new experiment assignment query that says how to get the experiment assignments by that id: https://docs.growthbook.io/app/datasources#identifier-types
i

incalculable-yacht-10590

09/26/2023, 8:28 AM
let me read it first, and i'll be back with a questions 😅
👍 1
hi @white-fireman-22476 i already set a new identifier type, but how to connect it with i set attributes?
and the other questions, do you guys provide the experiment directly or we need to create query to out data warehouse?
w

white-fireman-22476

09/27/2023, 3:41 PM
hi @white-fireman-22476 i already set a new identifier type, but how to connect it with i set attributes?
You need to create both the identifier type and the experiment assignment query: https://docs.growthbook.io/app/datasources#experiment-assignment-queries. Hopefully the default for the event-source type that you choose can just be modified to use your new identifier type.
do you guys provide the experiment directly or we need to create query to out data warehouse?
When creating metrics we provide sample queries given the event-source type you selected when making your data source. They are provided as-is and may need to be modified to match your particular schema or to make them more performant.
14 Views