Public dataset · Web, code and analytics
Google Analytics 360 Sample in BigQuery
The google_analytics_sample dataset is an obfuscated Google Analytics 360 (Universal Analytics) export from the Google Merchandise Store, one table per day from August 2016 to August 2017. It is 5.4 GiB in total, with one row per session and hits nested inside, so session-level queries read only a few MiB.
bigquery-public-data.google_analytics_sample holds obfuscated Google Analytics 360 data from the Google Merchandise Store, published by Google so people can practice analyzing GA360 data in BigQuery. The dataset description gives 2019-09-19 as its last update. It uses the older Universal Analytics export schema, not the GA4 one: if you work with GA4, use the GA4 sample instead.
There is one table per day, ga_sessions_YYYYMMDD, from 2016-08-01 to 2017-08-01. Each row is a session. Session totals are in the totals record, acquisition in trafficSource, device and geography in device and geoNetwork, and every pageview, event and transaction in the repeated hits record, which itself contains a repeated product record. Revenue fields are stored multiplied by 1,000,000, so divide by 1e6.
Three extra tables were added in 2025 and have no description: daily_total_visits, daily_visits and an empty Google-ecommerce-dataset-table.
Tables and sizes
The dataset has 369 tables; the main ones are listed.
| Table | Rows | Size | Full scan | Layout |
|---|---|---|---|---|
ga_sessions_YYYYMMDD366 daily tables, ga_sessions_20160801 to ga_sessions_20170801. Rows and size are the total of all 366. | 903,653 | 5.4 GiB | $0.03 | None |
daily_visitsNo description in the metadata. | 367 | 5.7 KiB | under $0.01 | None |
daily_total_visitsNo description in the metadata. | 366 | 5.7 KiB | under $0.01 | None |
Google-ecommerce-dataset-tableEmpty. | 0 | 0 B | under $0.01 | None |
Example queries
Sessions, pageviews and revenue per day in July 2017
Session-level totals live in the small totals record, so a month costs under 2 MiB.
SELECT
PARSE_DATE('%Y%m%d', date) AS day,
SUM(totals.visits) AS sessions,
SUM(totals.pageviews) AS pageviews,
SUM(totals.transactions) AS transactions,
SUM(totals.totalTransactionRevenue) / 1e6 AS revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`
WHERE _TABLE_SUFFIX BETWEEN '20170701' AND '20170731'
GROUP BY day
ORDER BY day;Sessions and transactions by source and medium, whole year
All 366 tables, but only four small columns.
SELECT
trafficSource.source,
trafficSource.medium,
SUM(totals.visits) AS sessions,
SUM(totals.transactions) AS transactions
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`
GROUP BY 1, 2
ORDER BY sessions DESC
LIMIT 20;Top products by revenue, whole year (expensive)
Unnesting hits and hits.product reads the nested hit data, which is most of the dataset's bytes.
SELECT
p.v2ProductName AS product,
SUM(p.productQuantity) AS units,
SUM(p.productRevenue) / 1e6 AS revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`,
UNNEST(hits) AS h,
UNNEST(h.product) AS p
WHERE p.productRevenue IS NOT NULL
GROUP BY product
ORDER BY revenue DESC
LIMIT 20;Top products by revenue for one month
The same query with a _TABLE_SUFFIX range reads 31 tables instead of 366, about 16 times fewer bytes.
SELECT
p.v2ProductName AS product,
SUM(p.productQuantity) AS units,
SUM(p.productRevenue) / 1e6 AS revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`,
UNNEST(hits) AS h,
UNNEST(h.product) AS p
WHERE _TABLE_SUFFIX BETWEEN '20170701' AND '20170731'
AND p.productRevenue IS NOT NULL
GROUP BY product
ORDER BY revenue DESC
LIMIT 20;Querying it cheaply
- Answer session-level questions from
totals,trafficSource,deviceandgeoNetwork. They are tiny compared withhits. - Add a
_TABLE_SUFFIXrange to everyga_sessions_*query that does not need the full year. - Unnesting
hits(andhits.product) reads the nested hit columns, the bulk of the 5.4 GiB. Select the specific hit fields you need rather thanh.*. - The data no longer changes, so repeated identical queries are served from the cache for free.
FAQ
How much does it cost to query the Google Analytics sample dataset?
Very little. The whole dataset is 5.4 GiB, so even a query over every column of every day is about half a percent of the free 1 TiB a month. Session-level queries read a few MiB.
Is the google_analytics_sample dataset free?
Yes for storage: the data sits in the bigquery-public-data project and Google pays to store it. You pay for the queries you run from your own project. On-demand, the first 1 TiB scanned each month is free, then you pay per TiB scanned (see BigQuery pricing).
Is google_analytics_sample GA4 data?
No. It is Google Analytics 360 data in the Universal Analytics export schema (ga_sessions_*, one row per session). GA4 exports one row per event in events_* tables; for that schema use ga4_obfuscated_sample_ecommerce.
Why is revenue so large in the GA360 sample?
Revenue fields such as totals.totalTransactionRevenue and hits.product.productRevenue are stored multiplied by 1,000,000. Divide by 1e6 to get currency units.
Related datasets
All public datasets · BigQuery cost queries · Pricing calculator
