Currently Available: Need a skilled Software Developer for your next project?
Categories
SEO, GEO and AEO

BigQuery SQL for Search Console Image and Video Exports

When you report page-level results from Google Search Console’s Image and Video tabs, you query searchdata_url_impression and filter search_type to image or video. You then group by each dimension you want to keep separate and sum the metric fields. Grouping this way keeps dates, URLs, and search types distinct so you do not mistake raw export rows for report totals.

Google Search Console exports performance data into BigQuery, Google’s data warehouse, in bulk. Each row’s dimensions describe what the numbers belong to, such as date, URL, country, and device. The search_type field identifies the Search surface, where image marks the Image tab and video marks the Video tab. A different field, is_video, identifies video appearances in Web results or Discover, so you use it to answer a different question.

Article setup: hypothetical example data. Technical explainer: direct mechanism. “Private trial 2026-10-04” is an editorial label only; no firsthand trial is claimed.

Separate search type from search appearance

Query searchdata_url_impression whenever you need URL-level reports. Google’s bulk-export table reference lists fields such as data_date, site_url, url, query, country, search_type, device, impressions, clicks, and sum_position. The other performance table, searchdata_site_impression, aggregates data at the property level and uses sum_top_position for position instead.

Filter search_type to image or video when you want traffic from those tabs. Filter is_video instead when you want video appearances inside Web results or Discover. In the same way, is_amp_image_result flags a specific AMP image appearance rather than all Image-tab traffic. Google’s Search results dimensions document each of these fields on its own.

The fields you place in GROUP BY define what one output row represents. If you group by date, property, search type, URL, country, and device, BigQuery returns one row for each combination of those values. If you omit a dimension, BigQuery rolls its values together. Google notes that export rows can repeat at a chosen key, so you must sum the metrics instead of treating each source row as a finished total.

Query Image and Video tab data by URL

The BigQuery SQL below returns daily metrics grouped by property, search type, URL, country, and device. Replace PROJECT_ID and the dataset name with the ones in your BigQuery account.

DECLARE start_date DATE DEFAULT DATE '2026-10-01';
DECLARE end_date   DATE DEFAULT DATE '2026-10-31';

WITH base AS (
  SELECT
    data_date,
    site_url,
    LOWER(search_type) AS search_type,
    url,
    country,
    device,
    impressions,
    clicks,
    sum_position
  FROM <code>PROJECT_ID.searchconsole.searchdata_url_impression
  WHERE data_date BETWEEN start_date AND end_date
    AND LOWER(search_type) IN ('image', 'video')
)

SELECT
  data_date,
  site_url,
  search_type,
  url,
  country,
  device,
  SUM(impressions) AS impressions,
  SUM(clicks) AS clicks,
  SAFE_DIVIDE(SUM(clicks), SUM(impressions)) AS ctr,
  SAFE_DIVIDE(SUM(sum_position), SUM(impressions)) + 1.0
    AS avg_position
FROM base
GROUP BY
  data_date,
  site_url,
  search_type,
  url,
  country,
  device
ORDER BY
  data_date DESC,
  impressions DESC;

Before BigQuery groups the rows, the query runs LOWER() on search_type. Google’s table reference lists lowercase values, while official examples have used uppercase values, so normalizing to lowercase keeps both the filter and the output consistent.

The query calculates click-through rate (CTR) by dividing total clicks by total impressions. You should avoid averaging the CTR of individual source rows, because doing so weights a row with one impression the same as a row with ten thousand. For URL-level average position, Google’s documented calculation is SUM(sum_position) / SUM(impressions) + 1. Adding 1 converts the zero-based stored values into the one-based average position Search Console displays. SAFE_DIVIDE returns NULL instead of throwing an error if the denominator is zero.

Include data_date in both SELECT and GROUP BY when you want daily rows. Leave data_date out of both clauses when you want a single total across the whole period, and BigQuery will combine every date in your filtered range.

Add query detail without dropping hidden queries

When you report results by query, add a query field to your grouping without dropping rows whose query text is hidden or unavailable. Search Console can leave anonymized query text null, and query strings can also arrive empty. Labeling those rows keeps their clicks and impressions in your totals without implying that you know the hidden search terms.

Add this expression to the base CTE:

CASE
  WHEN is_anonymized_query IS TRUE OR query IS NULL OR query = ''
    THEN '[anonymized or unavailable query]'
  ELSE query
END AS query_group

Then add query_group to both SELECT and GROUP BY. Avoid grouping on the raw query column alone if you need anonymized rows to stay visible and clearly labeled.

Report video appearances separately

When you want video appearances in Web results or Discover, filter search_type to those surfaces and check is_video. This query keeps those appearances separate from Video-tab traffic:

WITH base AS (
  SELECT
    data_date,
    site_url,
    LOWER(search_type) AS search_type,
    url,
    country,
    device,
    impressions,
    clicks,
    sum_position
  FROM <code>PROJECT_ID.searchconsole.searchdata_url_impression
  WHERE data_date BETWEEN DATE '2026-10-01' AND DATE '2026-10-31'
    AND LOWER(search_type) IN ('web', 'discover')
    AND is_video IS TRUE
)

SELECT
  data_date,
  site_url,
  search_type,
  url,
  country,
  device,
  SUM(impressions) AS impressions,
  SUM(clicks) AS clicks,
  SAFE_DIVIDE(SUM(sum_position), SUM(impressions)) + 1.0
    AS avg_position
FROM base
GROUP BY
  data_date,
  site_url,
  search_type,
  url,
  country,
  device;

IS TRUE matches only rows where the appearance flag is true. Because an appearance field can be null, and null is not true, use IS NOT TRUE rather than NOT field if you want to keep rows where the flag is false or unknown.

Handle dates and export updates

data_date stores the date of a Search Console click or impression, recorded in Pacific Time, and it also serves as the table’s partition column. Filtering data_date with explicit dates selects your reporting window and limits the partitions BigQuery scans.

Search Console runs the bulk export daily, but Google does not guarantee that the newest date is complete when you query it. To keep reports repeatable, set explicit start and end dates and decide whether to include the newest date. You can query ExportLog to verify which exports succeeded and whether Google updated a date:

SELECT
  data_date,
  namespace,
  MAX(epoch_version) AS latest_epoch_version,
  MAX(publish_time) AS latest_publish_time
FROM <code>PROJECT_ID.searchconsole.ExportLog
WHERE data_date BETWEEN DATE '2026-10-01' AND DATE '2026-10-31'
GROUP BY
  data_date,
  namespace
ORDER BY
  data_date DESC,
  namespace;

Google records the two performance tables separately in ExportLog, so check the namespaces for both the URL-level and property-level tables rather than assuming one entry covers both. A higher epoch_version tells you that Google republished that date. Because the log records successful exports and omits failed attempts, a missing entry will not tell you why an export did not appear.

Validate fields, values, and grouping

Check the table schema before you rely on a field in a scheduled query. BigQuery’s INFORMATION_SCHEMA.COLUMNS view lists each column’s name, data type, and whether it allows nulls.

SELECT
  column_name,
  data_type,
  is_nullable
FROM <code>PROJECT_ID.searchconsole.INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'searchdata_url_impression'
ORDER BY ordinal_position;

Inspect the search_type values in your export before adding a category to a production report. This query also reveals any differences in letter casing:

SELECT
  search_type,
  LOWER(search_type) AS normalized_search_type,
  COUNT(*) AS source_rows,
  SUM(impressions) AS impressions,
  SUM(clicks) AS clicks
FROM <code>PROJECT_ID.searchconsole.searchdata_url_impression
WHERE data_date BETWEEN DATE '2026-10-01' AND DATE '2026-10-31'
GROUP BY
  search_type,
  normalized_search_type
ORDER BY
  normalized_search_type,
  search_type;

Aggregate source rows whenever multiple rows share the same output key. Repeated rows by themselves do not mean the export is broken. This query locates grouped keys with more than one source row and shows their summed metrics:

SELECT
  data_date,
  LOWER(search_type) AS search_type,
  site_url,
  url,
  country,
  device,
  COUNT(*) AS source_rows,
  SUM(impressions) AS impressions,
  SUM(clicks) AS clicks
FROM <code>PROJECT_ID.searchconsole.searchdata_url_impression
WHERE data_date BETWEEN DATE '2026-10-01' AND DATE '2026-10-31'
  AND LOWER(search_type) IN ('image', 'video')
GROUP BY
  data_date,
  search_type,
  site_url,
  url,
  country,
  device
HAVING COUNT(*) > 1
ORDER BY source_rows DESC;

Compare totals on the same basis. The URL-level and property-level tables aggregate data differently and use different position fields, so their numbers may not match. Before you investigate a discrepancy, confirm that both queries use the same table, date range, search type, and grouping logic.

Keep multimodal Search separate

Google announced that properties with an active bulk export would get Search Console reporting for web multimodal search, including image-based searches such as Lens, available in BigQuery. The documented BigQuery table reference does not yet name the export field or search_type value for multimodal rows, so do not assume the API label webMultimodal appears in BigQuery.

Keep your Image-tab query separate from multimodal categories. Before you add a new category to a report, check the table schema and the search_type values in your export. If a new value shows up, verify what it represents against your property’s data and current Google documentation before you label it. Search Console’s multimodal reporting announcement also notes that text query data is unavailable for multimodal searches, so a query-level report should not imply that it includes those search terms.

What I'm building

Delegate tasks. Get software.

Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.

Take a look at vroni.com

Email updates

Usually a new article and a few links I found interesting.

No spam. Unsubscribe with one click.

Leave a Reply

Your email address will not be published. Required fields are marked *