Hey, I have two tables containing all experiments ...
# ask-questions
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!
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
(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)
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?
All experiments are like this! Every single one is in experiments_viewed, and if users convert they will be in experiment_won as well
okay, its not the fastest, but you could do the join in the experiment query
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?
what is stored in this experiments_won table? does it have a value?
It basically looks like this
Copy code
  CAST(received_at as DATETIME) as timestamp,
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)
so if the row exists, the user converted?
if it's missing, they did not convert?
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
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
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
Hey @future-teacher-7046 Any idea how this could be achieved? All help appreciated 🙌 I’m really excited about Growthbook so far
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
Thank you!
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?
Yes that is correct! Or alternatively have a where clause in the metric that could somehow access the experiment id (Tracking Key)
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?