<@U07FJ89LFFB> I can see the table with the metric...
# ask-ai
w
@brash-pillow-71627 I can see the table with the metrics in the "results" tab but the metrics are all in 0. How could I fix this? This is the query we are using:
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
  `learning-heroes-bq`.`analytics_372696867`.`events_*`,
  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'
I have removed the line
Copy code
AND user_pseudo_id is not null
because user_pseudo_ is not in our database, should I remove the second line too? anything else to change?
b
A message from kapa.ai
If your metrics are showing as zero in the "results" tab, but you can see the metric table, the most common causes are: 1. Identifier Mismatch: GrowthBook requires a user identifier (like
user_pseudo_id
or
anonymous_id
) to join experiment exposures to metric events. If you removed
AND user_pseudo_id is not null
because you don't have that field, you must ensure that the identifier you use in your experiment assignment query matches the identifier used in your metric queries. If you use a different column (e.g.,
user_id
), update both your experiment assignment and metric queries to use the same identifier consistently. Otherwise, GrowthBook cannot join the data, resulting in zeros for all metrics [[source](https://linen.growthbook.io/t/27125656/i-am-not-seeing-my-metric-in-my-experiment-the-values-stay-z)]. 2. Variation ID Type Mismatch: In GA4/BigQuery, sometimes
variation_id
is stored as a string, not an integer. If your data uses
variation_id_param.value.string_value
, but your query uses
.int_value
, the join will fail and metrics will be zero. Try changing:
Copy code
sql    variation_id_param.value.int_value AS variation_id
to
Copy code
sql    variation_id_param.value.string_value AS variation_id
and test if this returns data [[source](https://linen.growthbook.io/t/30129167/u07fj89lffb-i-can-see-experiment-data-in-bigquery-but-in-gro)]. 3. Missing or Incorrect Identifier: If you don't have
user_pseudo_id
, you must use another unique identifier (like
user_id
or a custom field) and ensure it's present in both your experiment and metric queries. If you remove the identifier filter entirely, GrowthBook may not be able to attribute metrics to users correctly [[source](https://linen.growthbook.io/t/15993334/hey-everyone-we-began-using-gb-two-weeks-ago-but-we-ve-encou)]. What to do: - Replace all uses of
user_pseudo_id
with your actual identifier column (e.g.,
user_id
) in both the experiment assignment and metric queries. - Make sure the
variation_id
type matches your data (try
string_value
if
int_value
returns no data). - Do not remove the identifier filter entirely; instead, update it to match your identifier column (e.g.,
AND user_id IS NOT NULL
). Example adjusted query (if using
user_id
and string variation_id):
Copy code
sql SELECT   user_id as anonymous_id,   TIMESTAMP_MICROS(event_timestamp) as timestamp,   experiment_id_param.value.string_value AS experiment_id,   variation_id_param.value.string_value AS variation_id,   ... FROM   ... WHERE   ...   AND user_id IS NOT NULL
If you still see zeros, double-check that your metric query uses the same identifier and that your metric events actually exist in the data for the experiment period [[source](https://linen.growthbook.io/t/27125656/i-am-not-seeing-my-metric-in-my-experiment-the-values-stay-z)]. If you need more help, please share the identifier column you are using and a sample of your metric query.
w
@brash-pillow-71627 help me find the user identifier in my GA4 database in Bigquery, how can I do it?
b
A message from kapa.ai
To find the user identifier in your GA4 database in BigQuery, you should look for the column named
user_pseudo_id
. This is the default unique identifier that GA4 assigns to each user and is present in every event record in the GA4 export to BigQuery. If your implementation also tracks logged-in users, you might see a
user_id
column as well, but this is only populated if you explicitly set it in your tracking setup. You can confirm this by running a simple query in your BigQuery GA4 dataset, such as:
Copy code
sql SELECT   user_pseudo_id,   user_id,   event_name FROM   `your_project.your_dataset.events_*` LIMIT 10
-
user_pseudo_id
is always present and is the main identifier for anonymous users. -
user_id
is only present if you set it in your GA4 implementation (typically for logged-in users). If you do not see
user_id
populated, you should use
user_pseudo_id
as your user identifier for experiments and metrics in GrowthBook [[source](https://linen.growthbook.io/t/16592082/hey-team-we-have-an-issue-with-receiving-data-from-a-gb-expe)]. If you have custom identifiers, you may need to check your event parameters or custom dimensions, but for standard GA4 setups,
user_pseudo_id
is the primary user identifier [[source](https://linen.growthbook.io/t/23126975/we-ve-implemented-growthbook-through-react-and-use-ga4-as-ou)]. If you are unsure which identifier to use, you can review your BigQuery table schema or run the above query to inspect the available columns.