<@U07FJ89LFFB> if I set up a data source like Reds...
# ask-ai
w
@brash-pillow-71627 if I set up a data source like Redshift, do I need to already have revenue and purchase data tracked in that database? Also, how do you match users in the experiments with their purchases?
o
A message from kapa.ai
Yes, in order to track revenue and purchase data with GrowthBook, you need to have this data already tracked in your data source, such as Redshift. You would typically have a table in your database that maps a user to which experiment/variation they saw. This is logged and stored in your data warehouse, like Redshift, using an event tracking system like Segment, Snowplow, Fivetran, Jitsu, or your own custom event tracking system[^1^]. GrowthBook matches users in the experiments with their purchases by joining based on the randomization unit you've assigned in the experiment report. It pulls a list of users (typically users, but could be anything) and then joins by that id to other metrics like bookings or revenue[^1^]. As long as those metrics can return a user id that can be joined back to the assignment id, you can build metrics around revenue and use those in the experiment analysis[^2^]. For example, you might have a table called
events
in your database, with columns for
user_id
,
timestamp
,
event_name
, and
value
(the total value of the event, in this case, the total value of a purchase). From this table, you can build many different metrics, such as 'Any Purchase', 'Number of Purchases', 'Order Value', and 'Average Order Value'[^5^]. [^1^]: [Forum Conversation > T > 33957](https://linen.growthbook.io/t/33957/hi-everyone-lately-i-ve-been-looking-at-growthbook-and-i-m-r) [^2^]: [Forum Conversation > T > 16012533 Part 2](https://linen.growthbook.io/t/16012533/hi-folks-trying-to-get-setup-with-growthbook-first-using-it-) [^5^]: [App > Metrics > Examples](https://docs.growthbook.io/app/metrics#examples)
w
mm, I will wait for the answer of the team to get more info