Integrating Google Analytics 4 traffic data with Bing Webmaster Tools AI Citation data

This is a follow-up from the post yesterday, and also a beginner’s starting point to learning how to make your BWT AI performance export data speak to your Google Analytics 4 data in things like Looker Studio.

Things to know ahead of time:

Make sure you have Google Analytics 4 exporting to BigQuery

Your Google Analytics 4 data needs to be exported into BigQuery. You aren’t going to be able to create a processed table in SQL that allows you to join the two datasets without it.

If you don’t know what I’m referring to, you can link your GA4 instance to BigQuery and send daily and streaming exports to BigQuery. You want to do this because GA4 does not store all of your data in perpetuity, unlike how Universal Analytics used to handle it. You can find this setting at the bottom of your admin section.

Lastly, my SQL query will reference the daily export data.

Create a BigQuery table with your Bing Webmaster Tools citation exports

Before you upload the data, you need to process it just a tiny bit.

The exports from BWT use this date format (3/21/2026 12:00:00 AM), whereas we need it in this date format (2026-03-21). Change the formatting.

Upload it to a dataset in BigQuery as a new table. I called mine bwt_ai_citation_data.

Bing Webmaster Tools AI Citation upload

The SQL query to process your GA4 data

A few things to know ahead of time:

Copy the script below and modify it at the following points:

CREATE OR REPLACE TABLE `example_project.example_dataset.ga4_processed_raw_data_for_bwt` AS
SELECT
  -- Converts GA4 'event_date' string (YYYYMMDD) to a standard DATE
  PARSE_DATE('%Y%m%d', event_date) AS visit_date,

  -- Extracts the Landing Page URL and strips query parameters
  -- Added LOWER() to ensure URL matching consistency for the future join
  LOWER(REGEXP_REPLACE(
    (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'page_location'),
    r'\?.*$', 
    ''
  )) AS landing_page_url,

  -- Counts Entrances (Sessions starting on this page)
  -- Aggregates all Copilot sources together for the same Date/URL
  COUNT(DISTINCT CONCAT(user_pseudo_id, (SELECT CAST(value.int_value AS STRING) FROM UNNEST(event_params) WHERE key = 'ga_session_id'))) AS entrances

FROM 
  `example_project.example_ga4_dataset.events_*`
WHERE 
  _TABLE_SUFFIX >= '20251101'
  AND event_name = 'session_start'
  AND (
    REGEXP_CONTAINS(traffic_source.source, r'copilot\.com|microsoft\.copilot\.com')
    OR REGEXP_CONTAINS((SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'source'), r'copilot\.com|microsoft\.copilot\.com')
  )
GROUP BY 
  1, 2

In BigQuery, run the query on your dataset. For now, I recommend saving the query, because you can use this to update your GA4 dataset every time you update your BWT export (that’s why it begins with CREATE OR REPLACE TABLE). Again, this isn’t the best way to do it, but once you start digging into BigQuery, SQL, and warehousing data, you’ll learn why – and it will also depend on the size of your data and what you process.

GA4 processed data to integrate with AI Citation export

After the query runs without errors, go look at the dataset where you created the table and make sure everything is fine. It should have 3 columns: visit_date, landing_page_url, and entrances.

The SQL query to join your processed GA4 data with your BWT data

Copy the script below and modify it at the following points:

CREATE OR REPLACE TABLE `example_project.example_dataset.integrated_copilot_data` AS
SELECT
  -- Use COALESCE to ensure we have a Date/URL even if one side is missing
  COALESCE(g.visit_date, c.Date) AS report_date,
  COALESCE(g.landing_page_url, c.SourcePageURL) AS page_url,
  
  -- Metrics: Use IFNULL to turn missing matches into 0 for cleaner reporting
  IFNULL(g.entrances, 0) AS sessions_from_copilot,
  IFNULL(c.Citations, 0) AS ai_citations

FROM 
  `example_project.example_dataset.ga4_processed_raw_data_for_bwt` AS g
FULL OUTER JOIN 
  `example_project.example_dataset.bwt_ai_citation_data` AS c
  ON g.visit_date = c.Date
  AND g.landing_page_url = c.SourcePageURL

ORDER BY 
  report_date DESC, 
  sessions_from_copilot DESC

In BigQuery, run the query on your dataset. Like the above, I recommend saving the query so you can re-run this in the future every time you update the data.

After the query runs without errors, go look at the table and make sure everything is fine.

Integrated GA4 and BWT citation data

Using the data in Looker Studio

Add your final BigQuery table as a new data source in Looker Studio. You can now create a dashboard that shows “impressions” (citations) and entrances for your site and for particular URLs, as well as calculate CTR.

Thoughts? Feedback?

Send me a message on LinkedIn.