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

microscopic-queen-6171

03/01/2022, 9:39 AM
Hey, I have two tables containing all experiments data. One called experiment_viewed which works perfectly as a source for all experiments, and then also an experiment_won with the same structure (that tells us whether users complete an experiment flow). When importing an experiment it correctly filters experiment viewed using experiment_id = ‘name of experiment’. However when I add experiment_won as a metric it will take all currently running experiments into account. Is there anyway that I can access the experiments tracking key inside of a metric? What I would like to have is a metric called Experiment won with a where clause like (where experiment_id={tracking_key}) or something similar. Otherwise I would have to create a new experiment_won metric for each experiment. Is this something that is possible to do? Thanks in advance!
f

fresh-football-47124

03/01/2022, 10:09 AM
Hi Malcolm, It sounds like you want to use the existence of a row in the experiment_won table as an activation metric.. is that right?
doing an activation metric will eliminate all users who do not have that metric event
m

microscopic-queen-6171

03/01/2022, 10:19 AM
(edit: its not an activation metric I’m after) That is correct! However experiment_won contains rows for all experiments (table structure identical to experiment_viewed). So if a user converts on one experiment, the experiment won metric will be inflated for all other experiments running at the same time. An easy solution would be to add a
where experiment_id = 'abtest1'
to the experiment won metric. But then I would have to recreate the same metric with a new where clause for every experiment. So I thought that if I could access the tracking key from within a metric it would automatically fill the where clause for me i.e
where experiment_id = {tracking_key}
(if a user is part of multiple A/B-tests running at the same time)
f

fresh-football-47124

03/01/2022, 10:23 AM
right, we have two sql variables, startDate, and endDate... we could probably add another
let me think if there is another way
are all experiments like this? or is it just one example?
m

microscopic-queen-6171

03/01/2022, 10:27 AM
All experiments are like this! Every single one is in experiments_viewed, and if users convert they will be in experiment_won as well
f

fresh-football-47124

03/01/2022, 10:27 AM
okay, its not the fastest, but you could do the join in the experiment query
m

microscopic-queen-6171

03/01/2022, 10:29 AM
I see.. So say that I left join experiment won onto viewed. What would the metric I should set up look like in this case?
f

fresh-football-47124

03/01/2022, 10:30 AM
what is stored in this experiments_won table? does it have a value?
m

microscopic-queen-6171

03/01/2022, 10:41 AM
It basically looks like this
Copy code
SELECT
  user_id,
  anonymous_id,
  CAST(received_at as DATETIME) as timestamp,
  experiment_id,
  variation_id,
  version
FROM
  experiment_won
So exactly how a source is set up (experiment viewed)
So it is the occurence of the row that is of interest, not really what is in the row (except user_id, timestamp and experiment_id)
f

fresh-football-47124

03/01/2022, 10:43 AM
so if the row exists, the user converted?
if it's missing, they did not convert?
m

microscopic-queen-6171

03/01/2022, 10:43 AM
Exactly!
f

fresh-football-47124

03/01/2022, 10:44 AM
hrmm
ya, I see the problem
its not really an activation metric then, as you want to include users who were in the experiment, but didn't convert
👍 1
so that _won row will be missing
I think @future-teacher-7046 may be able to find a workable solution
m

microscopic-queen-6171

03/01/2022, 10:51 AM
However since the users exist in the experiment_viewed (which is what I am using as a source) it does not really matter if they don’t exist in experiment_won. I’m just interested in the % of users in my test that has a row in experiment_won basically (with an experiment_id that matches that of the test the metric is in)
Ah yes I see what you mean now, no its not really an activation metric
f

fresh-football-47124

03/01/2022, 11:08 AM
right
it should work as normal, but they problem you'll get is if a user converts (so the user id matches) but the experiment id is different
👍 1
m

microscopic-queen-6171

03/04/2022, 8:27 AM
Hey @future-teacher-7046 Any idea how this could be achieved? All help appreciated 🙌 I’m really excited about Growthbook so far
f

fresh-football-47124

03/04/2022, 8:32 AM
Hi Malcolm. thinking about it - are you sure its not working as you have it set up?
here's my thinking
oh, nm, I still see it as a problem
well, potential problem
if a user converts after seeing another experiment, it will count to the first - which might not be entirely wrong... but let me talk to jeremy in the morning
m

microscopic-queen-6171

03/04/2022, 8:38 AM
Thank you!
f

future-teacher-7046

03/04/2022, 3:03 PM
When we join metric conversions to experiments, we only use a user_id. It sounds like you want the join to be based on both user_id and experiment_id, is that right?
m

microscopic-queen-6171

03/04/2022, 3:08 PM
Yes that is correct! Or alternatively have a where clause in the metric that could somehow access the experiment id (Tracking Key)
f

future-teacher-7046

03/04/2022, 3:10 PM
What we usually recommend doing is to separate your metrics into meaningful events, like "Signed Up", "Purchased", "Viewed Checkout", etc. as opposed to a single "Experiment won" metric. Then you can decide during analysis which metrics you want to include for each experiment.
Are there specific reasons you want to just have a single metric definition?
10 Views