Migrate Universal Aanalytics events to Google Analytics 4 title image

Migrate Universal Analytics events to Google Analytics 4

As you may know, Universal Analytics will stop processing data starting from July 1st, 2023. This urges a lot of website owners to migrate their existing Universal Analytics event setups to Google Analytics 4 to keep collecting the same data.
The difficult part for many people is that the new event structure used by GA4 is completely different from the previous version which creates a lot of confusion.

In this post, we will take a look at how to migrate UA events to GA4, the main differences, and how to efficiently plan your setup.

UA and GA4 event structure overview

Before getting your hands dirty with the setup it will be helpful to understand the core differences between UA and GA4 event structure.

Universal Analytics had 4 default parameters that you could use in any event:

  • Event Category
  • Event Action
  • Event Label
  • Event Value

Those would be available for reporting without any additional actions from your side. In addition to that, you could optionally pass any custom dimensions/metrics attached to that event.

In Google Analytics 4 there are no event parameters that were mentioned above anymore. By default, GA4 requires to provide only the Event name, which can include only up to 40 characters.

To send the same data to GA4 you need to create and use custom dimensions (event parameters). The simplest way is just to replicate the same event parameter names from Universal Analytics and send the same data to dimensions named event_category, event_action, etc.

Here is one way how you could replicate missing fields in the GA4 event:

  • Event name (default parameter)
  • event_category
  • event_action
  • event_label
  • event_value
  • currency (default parameter)

So this is how we would migrate values from UA to GA4 using a simplified structure:

Universal Analytics event

  • Event Category : Sidebar
  • Event Action : Navigation click
  • Event Label : {{ Link Title }}
  • Event Value : 1

Google Analytics 4 event

  • Event name : element_click

Event parameters ( Dimensions / Metrics)

  • event_category : Sidebar
  • event_action : Navigation
  • event_label : {{ Link Title }}
  • event_value : 1
  • currency: USD

A few notes on this example:

  1. We are using a generic “element_click” event and it’s really up to you how you name it. You can include more specific information in the event name and omit some of the custom dimensions (for example “navigation_sidebar_click” would work fine as well).
  2. Notice how we are passing the event_value parameter in GA4. This is a custom metric that you need to create by yourself (we will go through that in the setup part).
  3. When sending any kind of monetary value you need to pass the currency parameter.
    If you skip it, this data won’t be processed. Be sure to include it even if your website has only one currency and you have already added that in GA4 settings.

Take the GA4 event structure one step further

Since GA4 is built around events it offers you more flexibility in terms of structuring collected data. You can assign your parameters to serve a more specific purpose and collected data fields can be more intuitive rather than using generic placeholders.

You can add up to 25 event parameters (aka dimensions or metrics) per each event, which gives you a bit more flexibility for describing a specific event.

Let’s refactor the previous example a bit to use more specific event parameters:

Universal Analytics event

  • Event Category : Sidebar
  • Event Action : Navigation click
  • Event Label : {{ Link Title }}
  • Event Value : 1

Google Analytics 4 event

  • Event name : element_click

Event parameters ( Dimensions / Metrics)

  • element_location : Sidebar
  • element_type : Navigation
  • link_text : {{ Link Title }}
  • event_value : 1
  • currency: USD

A small change in parameter names gives much more context about what data we should expect. Also, we are using one of the default parameters “link_text” to pass dynamic link titles and save custom dimension quotas.

Now, imagine adding an additional event for an e-book download form, which is essentially a subscription form. We could re-use created custom dimensions there as well.

Google Analytics 4 event

  • Event name: subscription_success

Event parameters ( Dimensions / Metrics)

  • element_location: Blog post footer
  • element_type : E-book form
  • event_value : 5
  • currency: USD

In my opinion, these dimension names would give much more context about collected data than generic “event_category”, “event_action”, and “event_label”.

To use non-generic dimension names you would need to plan your measurements ahead and prepare at least an implementation plan specifically for GA4. Let’s take a look at this in a bit more detail.

Planning out event migration (Implementation plan)

From the examples above, we saw that there are multiple ways how you could map your data from Universal Analytics to GA4 format. There is no single correct approach but one thing always makes you see a clear picture – put everything on “paper”.

It is way easier to migrate Universal Analytics events to Google Analytics 4 once you have a concrete plan of what data you will collect. When all events and custom dimension structure has been created it’s just a matter of copy-pasting the values in GTM for the most part.

Also, when you see a high-level overview it’s easier to spot any inconsistencies or some space for optimization before any time is spent on implementation. Even if you don’t have many events at the moment, it is still a good idea to keep such documentation to use as a reference when preparing reports or when adding new events.

Key things to include in the GA4 implementation/migration plan

  • List all Universal Analytics events and any dimensions you are currently sending (if you don’t have that already).
  • For each UA event add Google Analytics 4 event details that you want to see in reports.
    • Create all event names to be reported in GA4.
    • List all parameters that will be sent together with each GA4 event to collect the same data as in UA.
  • Try to use custom dimensions that can be reused across different events.
  • Have a separate sheet/page that lists all your custom dimensions and metrics, describing the purpose of those.

For more complex setups you might want to revisit the plan a couple of times to make small adjustments in event and parameter naming. If you had a total mess in Universal Analytics event reports then it’s a great opportunity to make it suck less in GA4.

This document would serve you not only while planning/doing a migration but also as a great reference for anybody creating reports based on GA4 data later.

Implementation plan example

Here is a small example – UA and GA4 event was added to the spreadsheet outlining all parameters used. You can also document this in Confluence or any other tool that works best for you, the main idea is to have it planned out before the actual setup.

Google Analytics 4 event migration plan example

You would need to have this for each event that you want to migrate so that it’s clear what parameters to use, what values are expected, and maybe what can be optimized.

Migrate UA events to GA4 in Google Tag Manager

Let’s go through a practical example of how to migrate Universal Analytics event to Google Analytics 4.

Open your event tag and you should see something similar to what I have here.

I’ve added also a custom dimension here just so that it’s clear how to migrate those as well.

Copy the existing tag or create a new one and select type – GA4 Event.

Select your GA4 configuration tag and enter the event name as per your implementation plan. You should have it if you have basic GA4 tracking in place. Read this guide if you haven’t set up Google Analytics 4 via GTM yet.

I’m using “element_click” as my event name same as in the examples above.

NB! There is a limit of 40 characters for event names that you can use in GA4. Exceeding characters will be cut off from the event name but the event will still be collected.
For E.g. if you send this event name – “sidebar_navigation_click_google_data_studio_pos_1” then only “sidebar_navigation_click_google_data_stu” will reach GA4 reports.

Set event parameters and custom dimensions

Now, if we want to pass additional data the same way as in Universal Analytics we need to add Event Parameters (Custom dimensions and metrics).

I will add the following parameters here as per my implementation plan:

  • element_location – Is used instead of Event Category in this case. In general, will contain the element location names on the website structure.
  • element_type – Replaces Event action in this case. Overall will serve as a descriptive category of the element that is being tracked.
  • link_text – Will contain the same value as Event Label – Clicked element text value or title (default parameter)
  • element_position – Used instead of Custom dimension 5 from Universal Analytics
  • event_value – Replaces Event Value field
  • currency – Required to pass monetary value (default parameter)

Add the same trigger to your tag and save it.

Parameters marked in orange need to be created in the GA4 interface to be available for reporting.

Create Event custom dimensions in the GA4 interface

Any collected event parameters won’t work if it’s either not available by default or not created in GA4 UI.
I have a separate post dedicated to custom dimensions in GA4 if you want to learn more, so I will not dive into much detail here.

In Configure > Custom definitions create each required dimension with a scope of “Event” (unless you are migrating a User level custom dimension).
Make sure to use exactly the same Event parameter value as in the tag configuration.

The “event_value” is a metric so you need to switch to the “Custom metrics” tab and create it.
The only possible scope for custom metrics at the moment is Event. Pick Currency as a unit of measurement and mark it as revenue data if you want to have the ability to hide the values for users with certain permission levels.

If you want to assign a monetary value to any event you would basically always need to provide a custom metric (which can perfectly be a single metric for all events) and a default parameter “currency”.

How can you know if any of the custom dimensions can be replaced by the default parameter?

You can check Automatically collected event documentation most of the events have listed parameters that they use by default.
In my example “link_text” parameter comes from “file_download” event. Since we are tracking link text we can use it to save link text value instead of creating a separate custom dimension.

Note that some parameters can be used for data collection but are still not available for reporting, unless specifically created as a custom dimension. If the default parameter is available for reporting it should be available in the Explorations section (import custom dimensions and search for the custom parameter).

Testing event setup

Once all custom parameters have been created enable preview mode in GTM. Interact with the website so that your trigger (click, view, etc.) is fired.

Open Google Analytics 4 – Configure > Debug view section.

In the event timeline, you should see your event name. Click on it to get more details.

Here you can expand and see each of the parameters that were passed from GTM.

Prepare event reports in Google Analytics 4 after migration

Normally you will start seeing freshly collected event data in your custom reports only after the first 24h or more.

To see all relevant data about event parameters you need to create a new Exploration (Custom report).

Go to the “Explore” section and create a new Exploration report.

Exploration section in GA4 navigation menu
Create empty custom exploration report in Google Analytics 4

From the dimension list import “Event Name” and any Custom or default dimensions (event parameters) that you collect with the event. In my example, I want to see Link text, Element location, Element type, and Element position.

From Metrics import “Total Users” and if you want to see the monetary value that was assigned to your event you need to add “Event value” or the metric name that you use to collect that data.

In the Filter section add a filter to include only specififed events. In my case, it’s “element_click”.

Double-click on all remaining dimensions and metrics from the variables tab to add them to the report.
A reporting table should appear on the right side, similar to what I have below.

As you can see it contains all the custom dimensions that we have passed with our event and created in UI. You can filter this further to include only specific element types or locations (depending on what you want to analyze in the report).

Currency conversion in GA4 events

You have probably noticed that my event monetary value is 1.02 instead of the 1 USD that was provided in the event setup.
Google will automatically convert any event value using the previous day’s conversion rate if you are using a different currency from Property settings.

Since I’ve sent an event with 1 USD value but my property currency is EUR – Google converted that to 1.02 (since 1 EUR was worth 1.02 USD the day preceding the event).

When all custom dimensions have been created properly then it is relatively easy to report data in GA4.

Event quota and limitation comparison between GA4 and UA

There are some noticeable differences in how much data you can pass to Google. Here is a list of main quotas and limitations that should be considered when preparing to migrate events from Universal Analytics to GA4.

Universal Analytics event limits

  • Event Category length: 150 characters
  • Event Action length: 500 characters
  • Event Label length: 500 characters
  • Custom dimension count (standard): 20
  • Custom metric count (standard): 20
  • Custom dimension length: 150 characters

Google Analytics 4 event limits (web)

  • Event name length: 40 characters
  • Event parameter name length: 40 characters
  • Event parameter value length: 100 characters
  • Event scoped dimension count (standard): 50
  • User-scoped dimension count (standard): 25
  • Event scoped metric count (standard): 50

There are different limits for user-scoped dimensions in GA4 that you can check in the official documentation.

In case you had any events that actually have more than 100 characters in any of the Category/Action/Label fields, you will have to either trim it before sending it to GA4 or split values between multiple dimensions.

If the event name or other parameter values exceed limits they will be trimmed up to the character limit.

Summary

In this post, we have covered the main concepts of how to migrate Universal Analytics events to Google Analytics 4. Event structural change in GA4 is definitely something that you will have to get used to before feeling confident. Always prepare and document event setup considering new event limitations to capture all necessary data in a more logical way and it will be easier to do any kind of implementation.

I hope you found it useful and let me know if the comments if you’ll have any questions!

Leave a Reply

Your email address will not be published. Required fields are marked *