Site icon WP Htaccess Editor

Migrate from UA to GA4 BigQuery Export: End-to-End Tutorial

Universal Analytics (UA) is officially going away. If you haven’t already, it’s time to switch to Google Analytics 4 (GA4). Don’t panic! We’ll walk you through how to migrate your data export from UA to GA4 with BigQuery. And yes, we’ll make it fun, simple, and clear.

This guide covers everything — from setting up GA4 to getting your data into BigQuery. You’ll be exporting data like a pro in no time!

Why the Big Deal?

Google Analytics 4 is different. Not just a little different. Like, totally new platform different.

So moving your export over is not just important — it’s essential.

Step 1: Say Goodbye to UA (Respectfully)

If you’ve used Universal Analytics with BigQuery, you’re probably familiar with:

Well, GA4 changes that. Data is structured around events. Each hit is an event. Page views, clicks, purchases — all events. Much richer. Much more flexible.

But because it’s different, you can’t just copy-paste your old setup. You need to re-think your export strategy.

Step 2: Set Up GA4 (If You Haven’t Already)

Here’s how:

  1. Log into Google Analytics.
  2. Click on “Admin”.
  3. Under your current account, choose “Create Property”.
  4. Select “GA4 Setup Assistant”.
  5. Follow the prompts. It’s mostly just clicking “Next” and “Create”.

Done? Great. Your GA4 property is now ready to track data. But we’re here for BigQuery, right? Let’s go there next.

Step 3: Link GA4 to BigQuery

This part is super exciting because — unlike UA — GA4 lets everyone export data to BigQuery for free!

  1. Go to the GA4 property you created.
  2. Click Admin > BigQuery Links.
  3. Click Link.
  4. Choose the BigQuery project you want to connect to.
  5. Pick the data location (US or EU).
  6. Choose Daily and/or Streaming Export.
  7. Click Submit.

That’s it! Now GA4 will automatically create tables in BigQuery inside your project.

Step 4: Understand the New GA4 Data Structure

This part is crucial. GA4 data looks different from UA data.

In BigQuery, you’ll now see:

Key fields to know:

It takes a bit of SQL magic to get useful reports, but the power you unlock is next-level.

Step 5: Sample SQL Queries

Ready to crunch some numbers? Here are a few basic queries to get you started.

Query 1: Daily Pageviews

SELECT
  event_date,
  COUNT(*) AS pageviews
FROM
  `your-project.your_dataset.events_*`
WHERE
  _TABLE_SUFFIX BETWEEN '20240101' AND '20240131'
  AND event_name = 'page_view'
GROUP BY
  event_date
ORDER BY
  event_date;

Query 2: Most Popular Pages

SELECT
  ep.value.string_value AS page_path,
  COUNT(*) AS views
FROM
  `your-project.your_dataset.events_*`,
  UNNEST(event_params) AS ep
WHERE
  _TABLE_SUFFIX BETWEEN '20240101' AND '20240131'
  AND event_name = 'page_view'
  AND ep.key = 'page_location'
GROUP BY
  page_path
ORDER BY
  views DESC
LIMIT 10;

Query 3: Users by Country

SELECT
  geo.country,
  COUNT(DISTINCT user_pseudo_id) AS users
FROM
  `your-project.your_dataset.events_*`
WHERE
  _TABLE_SUFFIX BETWEEN '20240101' AND '20240131'
GROUP BY
  geo.country
ORDER BY
  users DESC;

These are just starters. Once you get comfy, you can build all kinds of cool reports.

Step 6: Validate Your Data

Now it’s time to make sure the new data is correct. You should:

Don’t worry if numbers don’t match exactly. The models are different. Focus on getting trend accuracy, not perfect copies.

Step 7: Archive Your UA Data

Even though UA is shutting down, you’ll still want to hold on to that data.

What you can do:

Whatever you choose, make sure important performance metrics are backed up.

Bonus: Visualization Tools

Want to make your GA4 data shine? You can use:

Just connect BigQuery as a data source and let your dashboards fly.

Final Thoughts

Moving from UA to GA4 may seem like a big leap. But it’s worth it. You get richer data, better export access, and a more future-proof analytics setup.

To recap:

GA4 is here to stay — and it’s powerful. BigQuery makes that power even greater.

Now go, play with data, and unlock the insights waiting for you!

Exit mobile version