GA4 Link Dimensions to BigQuery Mapping

Mapping GA4 Link Dimensions to their corresponding BigQuery fields provides valuable insights into how users interact with outbound links on your website or app. 

Here’s a breakdown of GA4 Link dimensions and their corresponding BigQuery fields:

GA4 Link DimensionsWhat it isBigQuery Field Name (Formula)
Link classesCaptures the HTML class attributes assigned to links.ARRAY_TO_STRING(ARRAY(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_classes'), ', ') AS link_classes
Link domainSpecifies the domain to which an outbound link points.(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_domain') AS link_domain
Link IDIdentifies the HTML ID attribute of a link.(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_id') AS link_id
Link textThe visible text of a link that users click on.(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_text') AS link_text
Link URLThe complete URL that an outbound link directs to.(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_url') AS link_url
OutboundIndicates whether a link directs to an external site.(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'is_outbound') AS is_outbound

Example SQL Query:

Here’s how you might structure a query to retrieve these link dimensions for a specific event, assuming these parameters are tracked:

SELECT
  event_name,
  ARRAY_TO_STRING(ARRAY(SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_classes'), ', ') AS link_classes,
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_domain') AS link_domain,
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_id') AS link_id,
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_text') AS link_text,
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'link_url') AS link_url,
  (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'is_outbound') AS is_outbound
FROM
  `your_dataset.your_table`
WHERE
  event_name = 'your_specific_event'

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