Webclat / GA4 Practice
Home / QA / Setup, SPAs and duplicate events

How do I migrate an existing analytics.js / Enhanced Ecommerce setup to GA4's gtag.js without losing history?

Quick answer

There is no technical mechanism to import Universal Analytics' historical data into GA4 - Google's own UA-to-GA4 path was always a parallel-tracking model, not a data migration, and Universal Analytics itself stopped processing new hits entirely in mid-2024. If you're only now moving a UA-based analytics.js/Enhanced Ecommerce setup, treat this as a fresh GA4 implementation guided by your old event taxonomy, and export any UA historical reports you still need before that data becomes fully inaccessible.

Why This Happens

01 / CAUSE

GA4 and Universal Analytics are built on fundamentally different data models - UA's session-and-pageview-hit model with Enhanced Ecommerce as an add-on layer versus GA4's flat, parameterized event model where ecommerce actions are just events with an items array. There's no lossless field-for-field mapping that preserves UA's historical rows inside GA4's schema, which is why Google never offered a backfill import even while both products ran side by side.

This is legacy-era context, not an active migration path: Universal Analytics fully stopped collecting data on July 1, 2024 (2024, standard UA) with the 360 variant following in 2024 as well, so a UA-based setup found today is not receiving new data at all - the practical task is reconstructing the tracking plan in GA4's terms and archiving whatever UA historical reporting is still needed, since UA's reporting interface itself has since been fully retired.

Fix It

02 / STEPS

Export whatever UA historical data you still need now

If your organization still has access to old UA reports or the UA data via BigQuery export (if that was ever linked), export what matters - custom report views, key historical trends - since UA's own reporting UI is no longer available to revisit later.

Rebuild your Enhanced Ecommerce actions as GA4 recommended ecommerce events

Map each UA Enhanced Ecommerce action to its GA4 equivalent: detail to view_item, add to add_to_cart, checkout steps to begin_checkout/add_shipping_info/add_payment_info, and purchase to GA4's purchase event - each carrying an items array rather than UA's separate product-scoped hit fields.

Rebuild custom dimensions as GA4 custom dimensions/user properties, not a 1:1 copy

UA's dimension-scope model (hit, session, user, product) doesn't map one-to-one onto GA4's (event, user, item) scopes - review each custom dimension's actual purpose and register it fresh under the closest matching GA4 scope rather than assuming a direct equivalent exists.

Re-map goals to GA4 key events deliberately

UA Goals (destination, duration, pages/session, event-based) don't automatically become GA4 key events - identify the underlying business action each goal represented and mark the corresponding GA4 event as a key event explicitly.

How To Verify It Worked

03 / VERIFY

In GA4 DebugView, walk through your full ecommerce funnel (view item through purchase) on the new gtag.js implementation and confirm each step fires the correct GA4 event name with a populated items array, comparing item count and value against what the old UA Enhanced Ecommerce setup would have reported for the same test order.

Once live, monitor GA4's standard Ecommerce purchases report for a full week against any parallel source of truth you have (order management system, payment processor) to confirm the rebuilt event schema is capturing the same transaction volume the UA setup used to, since this is the closest available substitute for a direct historical comparison.

Still Not Fixed?

We audit and fix GA4 implementations for a living - if this doesn't resolve it, the next step is usually a full event-by-event audit.

Talk to a GA4 Consultant