hi guys. Trying to connect GB with GA4 (via BigQue...
# ask-questions
c
hi guys. Trying to connect GB with GA4 (via BigQuery) to run A/B testing and stuck. Please help. Details: I have Nextjs app and it's set (gets experiment config from GB) .Works fine. I also linked GA4 with BigQuery because in BigQuery tables I see new event "experiment_viewed" which is fired from Nextjs app when needed (from
trackingCallback
) I connected GB to GA4 via BigQuery. I've created new experiment in GB. Now, when I'm trying to add BigQuery as Data source in experiment config, popup requires me to provide some
Experiment Assignment Table
.. which is empty. How to fix this?
w
In GrowthBook, go to Metrics and Data > Data Sources > click on the data source you created. Have you set any experiment assignment queries on this page?
You should set up something like this
c
oh.. got it. It's empty at the moment.
I'll try to create something there. Thank you!
w
No problem!
c
Hm, this is what I get trying to setup Experiment Assignment Queries:
when I check SQL query I see
Copy code
SELECT
  event_name as event_name,
  timestamp as timestamp,
  experiment_id as experiment_id,
  variation_id as variation_id
FROM my_table
and I'm not clear what is "my_table" and how it gets populated?
what bugs me additionally is that it tries to
select
fields I don't have in my tables. (all except 1st don't exist)
w
You need some SQL knowledge to get the right query. It needs to look like something like this: SELECT user_pseudo_id as anonymous_id, TIMESTAMP_MICROS(event_timestamp) as timestamp, experiment_id_param.value.string_value AS experiment_id, variation_id_param.value.int_value AS variation_id, geo.country as country, traffic_source.source as source, traffic_source.medium as medium, device.category as device, device.web_info.browser as browser, device.operating_system as os FROM
[put in your BigQuery dataset id]
, UNNEST(event_params) AS experiment_id_param, UNNEST(event_params) AS variation_id_param WHERE ((_TABLE_SUFFIX BETWEEN '{{date startDateISO "yyyyMMdd"}}' AND '{{date endDateISO "yyyyMMdd"}}') OR (_TABLE_SUFFIX BETWEEN 'intraday_{{date startDateISO "yyyyMMdd"}}' AND 'intraday_{{date endDateISO "yyyyMMdd"}}')) AND event_name = 'experiment_viewed' AND experiment_id_param.key = 'experiment_id' AND variation_id_param.key = 'variation_id' AND user_pseudo_id is not null
👀 1
But is also depends on the variables in your implementation code
c
oh.. this will be tough. Got it. Any way, thank you again for assistance 😉
w
No problem! Maybe the person who implemented the code (or someone with SQL knowledge within your organisation) can help you further!