[UA→GA4] Send events to both your UA and GA4 properties [Legacy]

You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.

By dual tagging you can keep your Universal Analytics implementation in place while you build out your Google Analytics 4 implementation.

This dual-tagging approach lets you build a historical record (and your skill base) in Google Analytics 4 while continuing to depend on Universal Analytics until you're ready to switch over.

In this article:

gtag.js dual tagging

If your Universal Analytics property is implemented with gtag.js, you can dual tag for your Google Analytics 4 property in one of the following ways:

When you have event measurement implemented in your UA property and you dual tag through gtag.js, if your UA property has not specified a 'send_to' command, your site will send events to both your UA and GA4 properties. The category/action/label values from your UA events automatically get translated to Google Analytics 4 events and parameters as follows.

  • Event action becomes an event name in the Google Analytics 4 property.
  • Event category, label, and value become event parameters in the Google Analytics 4 property (see below for limits on parameters)
Example
 
The following is an event in a Universal Analytics property implemented via gtag.js:
 

1: gtag('event', <action>, {

2: 'event_category': <category>,

3: 'event_label': <label>,

4: 'value': <value>

5: });

The event gets translated to a Google Analytics 4 property using the generalized event signature:

1: gtag('event', <event_name>, {

2: <parameter_1>: <parameter_1_value>,

3: <parameter_2>: <parameter_2_value>,

4: <parameter_3>: <parameter_3_value>,

5: ...

6: });

<action> in the Universal Analytics property maps to <event_name> in the Google Analytics 4 property and 'event_category', 'event_label', and 'value' — along with their respective values— map to parameters with values.

The enhanced measurement feature that is enabled by default in a Google Analytics 4 web data stream captures several types of core user interactions such as file downloads, outbound linking, and video tracking. If you are already tracking these interactions in Universal Analytics, you may want to avoid double counting the same user interactions by disabling them in the enhanced measurement settings.

The automatic event translation described above is a good option if you can't make code-level changes to your website. The downside of this automation is the additional configuration required to make all event dimensions meaningful and usable in Google Analytics 4.

Manually implement events after dual tagging

If you're able to make code-level changes to your site, we recommend that you approach event measurement in Google Analytics 4 with advance planning. Making code-level changes lets you control event parameter names at collection time.

In this case, you can take advantage of enhanced measurement in your Google Analytics 4 web data stream by leaving the tracking options enabled and by avoiding the manually-coded equivalents in the Google Analytics 4 implementation.

Continue to the article Map Universal Analytics events and custom dimensions to Google Analytics 4 for detailed guidance.

Google Tag Manager dual tagging

Google Tag Manager’s modularity and flexibility facilitate the process of building up your Google Analytics 4 implementation while maintaining your Universal Analytics implementation. In most cases, you can use many of the variables and triggers that you defined to populate Universal Analytics to also generate your Google Analytics 4 events and custom definitions.

 

With Google Tag Manager, you can use many of the same triggers and variables for Universal Analytics and Google Analytics 4 event tracking

analytics.js dual tagging

If your current implementation of Universal Analytics uses on-page calls to analytics.js, you will also need to add gtag.js or Google Tag Manager (or another tag management system) to your pages so you can begin sending data to Google Analytics 4 as well (via connected site tags or via Google Analytics 4 tagging).

In general, we don't recommend using the analytics.js library to send data to a Google Analytics 4 property. We suggest using the Google tag to send data to Google Analytics 4 and take advantage of all the benefits of the latest Google tag.

If you still want to use analytics.js, you can use a connected site tag or the Collect Universal Analytics events feature in your GA4 property to send analytics.js event, timing, and exception hits to a Google Analytics 4 property. Learn more

Ecommerce migration

The relative complexity of Google Analytics ecommerce tracking warrants special consideration in the context of Google Analytics 4 migration and dual tagging. For more details, see GA4 ecommerce migration in the Google help docs.

Modifying and creating events from the Analytics interface

Google Analytics 4 lets you modify events as they’re processed and also create new events based on other events and parameters. Learn how.

Modifying events

Event modification is comparable to aspects of view settings and view filters in Universal Analytics, but can also be used for more specialized purposes. Let’s consider the three use cases below.

Modifying events for consolidation

Let’s say that the thank-you-page URL for your contact-us submission contains an artifact that is not meaningful for your analysis and therefore unnecessarily fragments the page_location parameter value, e.g.:

https://mysite.com/thank-you?f9fslp43

https://mysite.com/thank-you?0fb3kixc

https://mysite.com/thank-you?l3kndj3b

You could consolidate page_location and streamline your analysis by configuring an event modification as follows:

 

Modify event

Modification name

Thank-You-Page Consolidation

Matching conditions
Parameter Operator Value
event_name equals page_view
page_location contains thank-you

Modify parameters
Parameter New value
page_location https://mysite.com/thank-you
  1. In Admin, under Data display, click Events.
  2. Click Modify event.
  3. Configure and save the event modification as follows:

    Modify event

    Modification name

    Map form_selection to Industry CD

    Matching conditions
    Parameter Operator Value
    event_name equals form_selection
    form_name equals lead-form
    field_name equals industry

    Modify parameters
    Parameter New value
    industry_selection

    [[field_selection]]

  4. In Admin, under Data display, click Custom definitions.
  5. Select Custom dimensions, then click Create custom dimensions.
  6. Configure and save the custom dimension as follows:

    New custom dimension

    Dimension Name Scope Event parameters
    Industry User industry_selection
  7. Repeat the steps above for the job title drop-down.

Modifying events to create more meaningful Google Analytics 4 event parameters with connected site tags

As outlined above, you can use connected site tags to collect data in a Google Analytics 4 property based on an existing gtag.js implementation of Universal Analytics. The challenge with this approach is to generate meaningful event parameters from the generic event_category, event_label, and custom dimension names that the connected site tag would push into Google Analytics 4 by default.

The event modifications in this case would be very similar to the previously outlined case and look something like:

Modify event

Modification name

Map event_label to social_network

Matching conditions
Parameter Operator Value
event_name equals connect
event_category equals social
field_name equals industry

Modify parameters
Parameter New value
social_network

[[event_label]]

Creating events

Creating events is especially useful for creating new events that you can designate as conversions in response to other events you collect. For more details, see Create a new conversion event via the user interface.

See [GA4] Modify and create events in the Analytics help center for more details on both of these processes.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
11614339817147254714
true
Search Help Center
true
true
true
true
true
69256
false
false