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

bumpy-finland-5739

11/20/2023, 2:10 PM
Hey Growthbook team, I have a question regarding metrics which I hope you can help me understand. Just to clarify a few details of our setup, we have both the JS and PHP SDK setup successfully with
experiment_viewed
event setup and pushing through the DL into GA4 and into BigQuery. We also have the
gb_user_id
in the event pushing successfully for each unique session. -- My question is, when we have an experiment setup and the
experiment_viewed
successfully firing with the correct experiment_id, variation_id and gb_user_id, do all the metrics for that experiment that are triggered based on GA4 events - e.g. add to cart, purchase need to have matching
gb_user_id
within the metric setup in GB? For example this is our current add_to_cart metric.
Copy code
SELECT
  (select value.string_value from unnest(user_properties) where key = 'gb_user_id') as consumer,
  (select value.string_value from unnest(event_params) where key = 'page_location') as page_location,
  event_name,
  TIMESTAMP_MICROS(event_timestamp) as timestamp,
  1 as value
FROM
  `growthbook-377317`.`analytics_320607085`.`events_*`
WHERE
  event_name = 'add_to_cart'
  AND (select value.string_value from unnest(user_properties) where key = 'gb_user_id') is not null
  AND ((_TABLE_SUFFIX BETWEEN '{{date startDateISO "yyyyMMdd"}}' AND '{{date endDateISO "yyyyMMdd"}}') OR
       (_TABLE_SUFFIX BETWEEN 'intraday_{{date startDateISO "yyyyMMdd"}}' AND 'intraday_{{date endDateISO "yyyyMMdd"}}'))
r

rhythmic-agent-34208

11/20/2023, 2:10 PM
Our official support hours are 6:30am - 5pm Pacific Time, Monday through Friday. You may occasionally hear from us outside of these hours. Your support request has been logged in our system. Our support team will get back to you very soon!
b

brief-honey-45610

11/20/2023, 2:29 PM
Hi Myles, thanks for reaching out! I’ve added your support request to the queue and we’ll follow up as soon as we can 😀
🙌 1
b

bumpy-finland-5739

11/21/2023, 12:04 AM
I just want to confirm some further notes on this. So we are pushing
gb_user_id
into
user_properties
- we are seeing sporadically that on multiple events we are missing gb_user_id from say add_to_cart, view_item, purchase etc… I don’t know GA4 and Bigquery connection well enough but could it be pushing into the user_properties that is causing the issues? Would we be safer pushing into event_params?
r

rhythmic-agent-34208

11/21/2023, 3:41 AM
Hi Myles, I spent some time trying to figure this out for you but need to speak with one of our BigQuery specialists in order to say for sure what the best approach is. I'll update you here once I have more info.
f

fresh-football-47124

11/21/2023, 5:08 AM
I’m not sure if that is the issue - but there are some ways to check
one would be to set up GrowthBook to use the GA4 clientId instead of your own id
the other would be to add the join table between gb_user_id and the GA4 clientId- you can do this from the data source page
then you can define the metric by the clientId
14 Views