GA4 Advertising Metrics to BigQuery Mapping

Here’s a breakdown of GA4 Advertising Metrics and their corresponding BigQuery fields:

GA4 Advertising MetricsWhat it isBigQuery Field Name (Formula)
Google Ads clicksThe total number of times users have clicked on your ads via Google Ads.SUM(google_ads_clicks)
Google Ads costThe cumulative amount spent on your Google Ads campaigns.SUM(google_ads_cost)
Google Ads cost per clickThe average cost incurred for each click received through your Google Ads campaigns.SUM(google_ads_cost) / SUM(google_ads_clicks) AS google_ads_cost_per_click
Google Ads impressionsThe total number of views or exposures your Google Ads campaigns have received.SUM(google_ads_impressions)
Google Ads video costThe total expenditure on video advertising within Google Ads.SUM(google_ads_video_cost)
Google Ads video viewsThe total count of views your video ads have garnered on the Google Ads platform.SUM(google_ads_video_views)
Non-Google clicksThe total number of clicks on your advertising campaigns not running on Google Ads.SUM(non_google_clicks)
Non-Google costThe overall cost associated with your non-Google advertising campaigns.SUM(non_google_cost)
Non-Google cost per clickThe average cost for each click on your non-Google advertising campaigns.SUM(non_google_cost) / SUM(non_google_clicks) AS non_google_cost_per_click
Non-Google cost per key eventThe average cost incurred for each key event triggered through your non-Google advertising campaigns.SUM(non_google_cost) / COUNT(non_google_key_events) AS non_google_cost_per_key_event
Non-Google impressionsThe total number of times your non-Google ads were displayed to users.SUM(non_google_impressions)
Return on non-Google ad spendThe revenue generated for every dollar spent on non-Google ads, considering all revenue streams against ad costsSUM(non_google_revenue) / SUM(non_google_cost) AS return_on_non_google_ad_spend

Points to consider

BigQuery Field Names (Formulas) provided above are conceptual and assume that you have fields in your BigQuery dataset that directly correspond to these metrics.

If these fields are not directly available, you may need to create them using custom calculations or ensure that your data collection setup in GA4 is configured to capture this data.

For example, the specific BigQuery field names provided, such as SUM(google_ads_clicks)SUM(google_ads_cost), etc., were illustrative and not directly pulled from the GA4 BigQuery export schema.

GA4’s BigQuery export does not directly provide fields named ‘google_ads_clicks‘, ‘google_ads_cost‘, ‘non_google_clicks‘, ‘non_google_cost‘, etc.

Instead, advertising metrics and costs are typically derived from the event data that GA4 exports to BigQuery, which requires parsing and aggregating specific event parameters related to advertising.

Let’s construct example SQL queries to calculate various Google Ads and non-Google advertising metrics.

These examples assume that you have linked your Google Ads account with GA4 and are utilizing BigQuery to analyze the exported data.

The metrics will be derived from custom fields or calculations based on the event data available in your GA4 BigQuery export.

Google Ads Clicks

SELECT
  SUM(metrics_clicks) AS google_ads_clicks
FROM
  `your_project.your_dataset.google_ads_table`

Do you want expert help in setting up/fixing GA4 and GTM?

If you are not sure whether your GA4 property is setup correctly or you want expert help migrating to GA4 then contact us. We can fix your website tracking issues.

Google Ads Cost

SELECT
  SUM(metrics_cost_micros) / 1000000 AS google_ads_cost
FROM
  `your_project.your_dataset.google_ads_table`

Google Ads Impressions

SELECT
  SUM(metrics_impressions) AS google_ads_impressions
FROM
  `your_project.your_dataset.google_ads_table`

Google Ads Video Cost

Assuming video cost is part of the cost metrics and needs to be filtered by video ad interactions:

SELECT
  SUM(metrics_cost_micros) / 1000000 AS google_ads_video_cost
FROM
  `your_project.your_dataset.google_ads_table`
WHERE
  segments_ad_network_type = 'VIDEO'

Google Ads Video Views

Assuming video views are tracked as a specific interaction type:

SELECT
  SUM(metrics_interactions) AS google_ads_video_views
FROM
  `your_project.your_dataset.google_ads_table`
WHERE
  metrics_interaction_event_types = 'VIDEO_VIEW'

Non-Google Advertising Metrics

For non-Google advertising metrics, let’s assume you are tracking these through custom events or parameters in GA4 that are then exported to BigQuery.

The specific field names and calculations might vary based on how you’ve set up tracking for these metrics.

Non-Google Clicks

SELECT
  COUNT(*) AS non_google_clicks
FROM
  `your_project.your_dataset.events_*`
WHERE
  event_name = 'non_google_ad_click'

Non-Google Key Events

Assuming a key event is defined and tracked explicitly:

SELECT
  COUNT(*) AS non_google_key_events
FROM
  `your_project.your_dataset.events_*`
WHERE
  event_name = 'non_google_key_event'

Non-Google Impressions

SELECT
  COUNT(*) AS non_google_impressions
FROM
  `your_project.your_dataset.events_*`
WHERE
  event_name = 'non_google_ad_impression'

Non-Google Revenue

Assuming revenue from non-Google ads is tracked as part of event parameters:

SELECT
  SUM(event_params.value.double_value) AS non_google_revenue
FROM
  `your_project.your_dataset.events_*`,
  UNNEST(event_params) AS event_params
WHERE
  event_name = 'purchase' AND
  event_params.key = 'non_google_ad_revenue'

Non-Google Cost

Assuming the cost for non-Google ads is tracked similarly:

SELECT
  SUM(event_params.value.double_value) AS non_google_cost
FROM
  `your_project.your_dataset.events_*`,
  UNNEST(event_params) AS event_params
WHERE
  event_params.key = 'non_google_ad_cost'

Note: The specific calculations and field names might need adjustments based on your data schema and how you have configured tracking for Google Ads and non-Google advertising metrics.

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade