---
title: "Universal Analytics to GA4 Migration: What You Need to Know"
description: "Guide to migrating from Universal Analytics to Google Analytics 4. Differences in data model, events, and reports. How to preserve historical UA data."
date: 2023-03-15
updated: 2026-01-08
category: Analytics
tags: ["Google Analytics", "GA4", "Universal Analytics", "Migration"]
url: https://uper.pl/en/blog/ua-ga4-migration/
---

# Universal Analytics to GA4 Migration: What You Need to Know

**Universal Analytics** (UA) was officially deprecated by Google on July 1, 2023. If you haven't yet migrated to **Google Analytics 4** (GA4), you're losing traffic data for your website. This guide explains the key differences and helps with migration.

## Universal Analytics Status

| Date | Event |
|------|-------|
| July 2023 | UA stopped collecting new data |
| July 2024 | Access to historical UA data ended |

**If you don't have GA4 yet, you need to implement it immediately** - every day without GA4 is lost data.

## Key Differences: UA vs GA4

### Data Model

| Aspect | Universal Analytics | GA4 |
|--------|--------------------|----|
| Basic unit | Session | Event |
| Page views | pageview hit | page_view event |
| Users | Cookie-based | User ID + Device ID |
| Bounce rate | Sessions without interaction | Replaced by Engagement rate |
| Conversion paths | Linear | Data-driven attribution |

### Event Model

**Universal Analytics:**
```javascript
// UA - category, action, label
ga('send', 'event', 'Video', 'Play', 'Homepage Video');
```

**GA4:**
```javascript
// GA4 - event name + parameters
gtag('event', 'video_play', {
  video_title: 'Homepage Video',
  video_duration: 120
});
```

### Standard GA4 Events

GA4 defines [recommended events](https://support.google.com/analytics/answer/9267735):

| Event | Usage |
|-------|-------|
| `page_view` | Page view |
| `scroll` | Scroll 90% of page |
| `click` | Outbound link click |
| `view_search_results` | Search results |
| `file_download` | File download |
| `purchase` | Purchase (e-commerce) |
| `sign_up` | Registration |
| `login` | Login |

## How to Implement GA4

### Option 1: gtag.js (directly)

```html
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>
```

### Option 2: Google Tag Manager (recommended)

1. Create a **GA4 Configuration** tag in GTM
2. Enter Measurement ID (G-XXXXXXXXXX)
3. Trigger: All Pages
4. Publish container

Details about GTM: [dataLayer Best Practices](/en/blog/datalayer-best-practices/)

### Option 3: Server-Side GTM

For better performance and privacy: [GTM Server-Side vs Client-Side](/en/blog/gtm-server-side-vs-client-side/)

## E-commerce Migration

### UA Enhanced Ecommerce → GA4 Ecommerce

Event names have changed:

| UA Event | GA4 Event |
|----------|-----------|
| `productClick` | `select_item` |
| `addToCart` | `add_to_cart` |
| `removeFromCart` | `remove_from_cart` |
| `checkout` | `begin_checkout` |
| `purchase` | `purchase` |

### Data Structure

**UA Enhanced Ecommerce:**
```javascript
dataLayer.push({
  'event': 'addToCart',
  'ecommerce': {
    'add': {
      'products': [{
        'name': 'Product',
        'id': 'SKU123',
        'price': '99.99',
        'quantity': 1
      }]
    }
  }
});
```

**GA4 Ecommerce:**
```javascript
dataLayer.push({ ecommerce: null }); // Clear previous
dataLayer.push({
  'event': 'add_to_cart',
  'ecommerce': {
    'currency': 'USD',
    'value': 99.99,
    'items': [{
      'item_id': 'SKU123',
      'item_name': 'Product',
      'price': 99.99,
      'quantity': 1
    }]
  }
});
```

## Goals Migration (Goals → Conversions)

In GA4, there are no "goals" - there are **conversions**, which are marked events.

### How to Create a Conversion in GA4

1. Go to **Admin** → **Events**
2. Find the event you want to track as a conversion
3. Enable the **Mark as conversion** toggle

Or create a new event:
1. **Admin** → **Events** → **Create event**
2. Define conditions (e.g., `page_location` contains `/thank-you`)

## What Happened to UA Metrics?

### Bounce Rate → Engagement Rate

GA4 doesn't have traditional Bounce Rate. Instead:

- **Engagement rate** - % of engaged sessions (>10s, 2+ page views, or conversion)
- **Engaged sessions** - number of engaged sessions

### Average Time on Page → Average Engagement Time

GA4 measures actual time when the page is in the foreground.

### Users

| UA | GA4 |
|----|-----|
| Total Users | Total users |
| New Users | New users |
| - | Active users (default) |

## Exporting Historical UA Data

Google ended access to UA data in July 2024. If you have a copy:

### BigQuery Export

If you exported UA data to BigQuery, you have it forever.

### PDF/CSV Reports

Export key reports before losing access.

### Google Analytics API

```python
# Example export via API (Python)
from googleapiclient.discovery import build

analytics = build('analyticsreporting', 'v4', credentials=credentials)

response = analytics.reports().batchGet(
    body={
        'reportRequests': [{
            'viewId': 'VIEW_ID',
            'dateRanges': [{'startDate': '2020-01-01', 'endDate': '2023-06-30'}],
            'metrics': [{'expression': 'ga:sessions'}],
            'dimensions': [{'name': 'ga:date'}]
        }]
    }
).execute()
```

## GA4 Integration with Other Services

### Google Ads

1. **Admin** → **Product Links** → **Google Ads Links**
2. Connect accounts
3. Enable automatic conversion import

### Search Console

1. **Admin** → **Product Links** → **Search Console Links**
2. Connect Search Console property

### BigQuery

1. **Admin** → **BigQuery Links**
2. Create link to GCP project
3. Choose export frequency (daily/streaming)

## Migration Checklist

### Before Migration
- [ ] Create GA4 property
- [ ] Document current UA goals and events
- [ ] Plan UA → GA4 event mapping

### Implementation
- [ ] Implement GA4 code (gtag.js or GTM)
- [ ] Configure basic events
- [ ] Implement e-commerce tracking (if applicable)
- [ ] Create conversions

### After Migration
- [ ] Compare UA and GA4 data (during overlap period)
- [ ] Configure reports and dashboards
- [ ] Connect to Google Ads and Search Console
- [ ] Consider BigQuery export

## Summary

Migration from UA to GA4 is not just a code change - it's a change in how you think about analytics:

1. **Event-centric** - everything is an event
2. **User-centric** - tracking users, not sessions
3. **Privacy-first** - Consent Mode, cookieless tracking
4. **ML-powered** - predictive analytics, modeling

GA4 offers more capabilities than UA, but requires learning a new interface and data model.

## Sources

1. **Google Analytics Help - Set up Analytics for a website**
[https://support.google.com/analytics/answer/9304153](https://support.google.com/analytics/answer/9304153)

2. **Google Analytics Help - GA4 recommended events**
[https://support.google.com/analytics/answer/9267735](https://support.google.com/analytics/answer/9267735)

3. **Google Developers - GA4 Ecommerce**
[https://developers.google.com/analytics/devguides/collection/ga4/ecommerce](https://developers.google.com/analytics/devguides/collection/ga4/ecommerce)

4. **Google Analytics Help - UA sunset**
[https://support.google.com/analytics/answer/11583528](https://support.google.com/analytics/answer/11583528)

5. **Google Tag Manager - GA4 Configuration tag**
[https://support.google.com/tagmanager/answer/9442095](https://support.google.com/tagmanager/answer/9442095)
