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

happy-lamp-67598

01/23/2024, 8:06 AM
Hello, I am not receiving the experiment_viewed event in GA4 or BigQuery. We have set up GA4 and BigQuery as described and connected it with Growthbook. In the console, I can see that the callback is fired when I see the experiment. What have I missed?
b

brief-honey-45610

01/23/2024, 9:13 AM
Hello 👋🏻 Did you make sure that you're sending the
experiment_viewed
event through the dataLayer inside of the trackingCallback? Can you send me a screenshot or code snippet of the trackingCallback?
Can you confirm that the
experiment_viewed
event is present in your BigQuery dataset?
h

happy-lamp-67598

01/23/2024, 9:26 AM
Hey August, thanks for your quick reply. @icy-zoo-15602 can you provide the code snippet, please? No the event is not present, do I have to add it manually?
@brief-honey-45610 here is the code snippet:
Copy code
growthBook = new GrowthBook({
            enableDevMode,
            trackingCallback: (experiment, result) => {
              dispatch(`${GENERAL}/trackGoogleAction`, {
                payload: {
                  event: 'experiment_viewed',
                  event_category: 'experiment',
                  experiment_id: experiment.key,
                  variation_id: result.variationId,
                },
              });
            },
There is also an error shown with our Experiment Assignment Query, but that is because we do not receive the event in Big Query?
Copy code
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
  `growthbook-ga4-396012`.`analytics_308238632`.`events_*`,
  UNNEST(event_params) AS experiment_id_param,
  UNNEST(event_params) AS variation_id_param
WHERE
  _TABLE_SUFFIX BETWEEN '{{startYear}}{{startMonth}}{{startDay}}' AND '{{endYear}}{{endMonth}}{{endDay}}'
  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
Can someone help here?
m

mammoth-belgium-33983

02/02/2024, 2:04 PM
Try checking if
experiment_viewed
appears as datalayer in your browser, if it does, you can then map it with GTM to pass it to GA as an event
h

happy-lamp-67598

02/05/2024, 5:58 AM
Shouldn't the tracking callback work without GTM?
m

mammoth-belgium-33983

02/05/2024, 1:57 PM
it should, but for some reason it didn't work for us out of the box
3 Views