Hey guys, i have a doubt in setting up the session count metric for the GA4 account connected to Bigquery. I know we have session_start metric. But when ever the repeat user visits the website the session_start metric doesn't works well. So i want to count the total session based on session_id which gets recorded in the event_params key. Below is the example of query i set up in the GB but the end results which results in the experiment is very huge (If the user count is 1000, the session count which appears there is 20k)
SELECT
user_pseudo_id as anonymous_id,
TIMESTAMP_MICROS(event_timestamp) as timestamp,
count(
DISTINCT CONCAT(
user_pseudo_id,
"-",
(
SELECT
value.int_value
FROM
unnest (event_params)
WHERE
key="ga_session_id"
)
)
) as value
FROM
red-land-cotton-ga4.analytics_309366137.events_*
GROUP BY
1,
2