Skip to content

Instantly share code, notes, and snippets.

@lfy79001
Last active April 10, 2024 03:37
Show Gist options
  • Save lfy79001/fa2a98f63d3a05605eb5c8eb679646d4 to your computer and use it in GitHub Desktop.
Save lfy79001/fa2a98f63d3a05605eb5c8eb679646d4 to your computer and use it in GitHub Desktop.
SELECT
item_id,
item_name,
COUNT(DISTINCT user_pseudo_id) AS user_count
FROM
`bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`, UNNEST(items)
WHERE
_TABLE_SUFFIX BETWEEN '20201101' AND '20201130'
AND event_name IN ('add_to_cart')
GROUP BY
1, 2
ORDER BY
user_count DESC
LIMIT 10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment