Migrate Existing Google Analytics Integration to Google Analytics 4

This content is for clients that have previously integrated an earlier version of Google Analytics with Monetate and now need to update that integration after creating a Google Analytics 4 property. If you have never integrated your Google Analytics setup with Monetate, then follow the instructions in the Monetate Knowledge Base Google Analytics documentation.

Prerequisites

Google has announced that on July 1, 2023, its standard Universal Analytics properties will stop processing data. Before that date, you must create a custom report in the Monetate platform that uses one of the third-party analytics code samples written for Google Analytics 4 (GA4) with Google Tag and then use that custom report for any active experiences.

If your account has a custom Google Analytics integration created by Monetate's Development Services team, then you must submit a request using the Kibo Technical Support portal at kibotechsupport.zendesk.com for the integration to be updated.

You must have a GA4 property before you can create the custom report in Monetate. Refer to Google's Make the switch to Google Analytics 4 documentation to learn how to create the property.

If you don't create a GA4 property, then your existing Google Analytics integration with Monetate will continue to use the legacy version of Google Analytics until July 1, 2023, the date when Google stops collecting data for its standard Universal Analytics properties.

Creating the Custom Report

Follow these steps to create a custom Google Analytics report that's compatible with your GA4 property.

  1. Click the settings icon in the top navigation bar and then select Integration.

    Callout of the Integration option in the settings menu

  2. Click GOOGLE ANALYTICS in the list of third-party analytics reports.

    Callout of the GOOGLE ANALYTICS option in the list of reports on the 'Third-Party Analytics' tab of the Integration page

  3. Confirm that the existing Google Analytics report uses a legacy version of Google Analytics.
    1. Click SHOW THE CODE BEING USED TO REPORT DATA.

      Callout of the 'SHOW THE CODE BEING USED TO REPORT DATA' button

    2. Confirm that the code does not include gtag.

      Many accounts with a standard Google Analytics integration use code much like the one shown in the screenshot. Do not confuse the reference to Google's Universal Analytics (analytics.js) in line 3 and to its Legacy Analytics (ga.js) in line 12 with GA4 (gtag.js).

      Callout of line 3 that reads, 'Universal Analytics (analytics.js),' and of line 12 that reads, 'Legacy Analytics (ga.js)' in the code for a Google Analytics integration

  4. Click ADD REPORT and, if necessary, select Custom.

    Callout of the 'Custom' option in the ADD REPORT button menu

  5. Give the report a name that differentiates it from the existing Google Analytics report.

    Callout of the Title field for a new custom report

  6. Copy one of the code samples for GA4 from Code Samples for Third-Party Analytics Integrations, and then paste it into the code editor.

  7. Leave Enable by default for all new experiences set to NO.

    Callout of the 'Enable by default for all new experiences' toggle

  8. Click CREATE.

    Callout of the CREATE button

Test the new report configuration to ensure it works as expected. Do not add it to any active Web experiences nor enable it for all new Web experiences until you test it.

If you have multiple legacy Google Analytics reports in one domain, ensure that you create and test a new GA4-compatible report for each of them.

Testing the New Report

You can ensure the new GA4 report works from the report configuration page by adding the JavaScript console.log() method to whichever GA4 report code you input into the code editor.

The following example is the Google Analytics 4 with Google Tag (Minimal) code with the console.log() method added.

if (typeof(window.gtag) === "function") {
  for (var i = 0; i < campaigns.length; i++) {
    var campaign = campaigns[i];
    window.gtag('event', campaign.key, {
      'event_category': 'Monetate',
      'event_label': campaign.split,
      'non_interaction': true
    });
  }
  console.log("Google Analytics 4");
}

Follow these steps to test the new report.

  1. Add the console.log() method to the GA4 report code.

    Callout of the 'console.log()' method added to code for a Google Analytics 4 report

  2. Click the preview icon.

    Callout of the preview icon for a for a Google Analytics 4 report configuration

  3. While viewing the new browser tab or window in which your site loaded in Preview Mode, open your browser's developer tools and then switch to its console.

    A retail site, with a message that states, 'PREVIEWING:  GA4' below the active portion of the browser window. The browser developer tools window is docked below the message, with a callout of the 'Console' tab

  4. Ensure the message that you used with the console.log() method in the GA4 report code is present in the console.

    Callout of the 'Google Analytics 4' message resulting from the 'console.log()' method used in the GA4 report's code

  5. In the Monetate platform, remove the console.log() method from the GA4 report code, set Enable by default for all new experiences to YES, and then click SAVE.

    Callout of the 'Enable by default for all new experiences' toggle set to YES and of the SAVE button

After you've created and tested all the new GA4-compatible reports across all the domains of your Monetate account, complete the table of report names that your Customer Success Manager (CSM) emailed to you, and then return it so that Monetate Engineering can then deploy the new reports to their respective active Web experiences.

You can view a table of experiences that Monetate is reporting to a GA4 setup on its respective custom report configuration screen of the Third-Party Analytics tab of the Integration page of the Monetate platform settings.

Callout of the 'View Associated Experiences' section of the Google Analytics third-party integration configuration

To disable Google Analytics reporting for a single experience, click its name in this table to open it in Experience Editor, then click the additional options menu (...), click Third-Party Analytics, and then toggle Google Analytics to NO in the Third-Party Analytics modal.

Archiving a Legacy Google Analytics Report

After Monetate has enabled the new GA4-compatible report for each active Web experience, you can optionally archive the legacy Google Analytics report(s). If you choose to archive a report, you cannot reactivate it.

While archiving a legacy Google Analytics report is optional, Monetate recommends doing so not only to prevent your users from potentially confusing the legacy report with the GA4 report if they adjust the enabled third-party analytics for an experience but also to prevent analytics from potentially being skewed by having two different Google Analytics reports enabled for the same experience.

Follow these steps to archive a legacy Google Analytics report.

Do not archive the legacy Google Analytics report until Monetate has enabled the new GA4 report for all active experiences.

  1. Click the legacy Google Analytics report in the list of third-party analytics reports.

    Callout of the GOOGLE ANALYTICS option in the list of reports on the 'Third-Party Analytics' tab of the Integration page

  2. Click the archive icon.

    Callout of the archive icon for the Google Analytics report on the 'Third-Party Analytics' tab of the Integration page

  3. Click OK to confirm that you want to archive the report.

    Callout of the OK button on a modal that states, 'This report is currently in use. Are you sure you want to archive it?'

After you click OK, Monetate disables and removes the legacy Google Analytics report from the Third-Party Analytics modal for all existing experiences.

FAQ

Can I determine if my Google Analytics setup is using Universal Analytics or Google Analytics 4 if I'm not logged into Monetate?

When you're logged into the Google Analytics platform, look for these clues to help you determine if you're using UA or GA4:

  • If you're using UA, you'll see a blue notification at the top of your account that states UA will no longer be processing new data after July 1, 2023. If you previously dismissed the notification, it will no longer appear.
  • If you set up a Google Analytics account before October 14, 2020, then you're likely using UA. Otherwise, you're likely using GA4.
  • A UA property ID starts with UA and ends with a number (for example, UA-123456789-1). A GA4 property ID only contains numbers.

For more information see Google's How to check whether you have Universal Analytics or Google Analytics 4 (GA4) documentation.

Can Monetate help me migrate my UA property to my GA4 property?

No, Monetate cannot provide any assistance setting up your GA4 property in the Google Analytics platform and on your site.

Monetate does not make any modifications to your site to make it GA4 compatible. You must ensure that your GA4 property is properly configured and that you're able to send analytics to your GA4 property. If you intend to use dual tagging so that data is reported to both your UA and GA4 properties until the deprecation deadline, you must ensure the tags are configured correctly.

Google has released migration guides targeting everyone from beginners to advanced users. Monetate strongly encourages you to follow one of these guides to migrate your Google Analytics property:

You may also find assitance customizing your GA4 setup in Google's Common reporting solutions in Google Analytics 4.

Setting Up Google Analytics 4

What actions must I take to set up a new GA4 property for my site?

Setting up a GA4 property is the first step for some sites. If you haven't created a GA4 property, Google will automatically create one for you and copy to it your UA configurations unless you opted out.

Google strongly recommends that you manually migrate your settings to the new GA4 property because not all settings are easily migrated between the two properties. See Google's Migration reference for more information.

See Automatically created Google Analytics 4 properties from Google for more information.

You must also add GA4's gtag.js snippet to your site. Like its UA analytics.js counterpart, it allows you to send analytics to your Google Analytics setup. Furthermore, Monetate uses this code to push experience metrics to your Google Analytics account via the third-party analytics integration that either you created in the Monetate platform or that Monetate's Delivery Services team created for you. To learn more about adding gtag.js to your site, refer to the Add a Google Analytics 4 property (to a site that already has Analytics) and Tips for switching from analytics.js to gtag.js guides from Google.

Refrain from setting up a GA4 integration in the Monetate platform until after you've set up GA4, deployed gtag.js on your site, and confirmed the new property is working correctly.

Is my GA4 property connected to my UA property?

To determine if your two properties are connected, load your Google Analytics GA4 property in a browser, click the settings cog, and then select Setup Assistant. If your GA4 property is connected to your UA property, then beside the "Setup Assistant" heading appears Connected to [name of your UA property] in green text. If this green text doesn't appear, then your GA4 property isn't connected to your UA property. See Google's documentation for additional assistance.

Why does data from my site look different in GA4?

Some metrics in GA4 may not align with the metrics collected in UA. These metrics may be impacted:

  • Users
  • Page views
  • Purchases
  • Sessions
  • Session/traffic-based acquisition metrics
  • Conversions
  • Bounce rates
  • Event counts

Learn more about how GA4 functionality compares to UA in Google's Migration reference. See Comparing metrics: Google Analytics 4 vs. Universal Analytics to better understand the extent to which you can and can't compare metrics between the two versions.

Tags

Do I still have to set up GA4 if I already have gtag.js on my site and use it with Universal Analytics?

Using gtag.js on your site doesn't exempt you from migrating to GA4. Refer to How gtag.js for UA maps to GA4 to better understand what you need to do.

Can I use both gtag.js and analytics.js on my site?

Completely switching from analytics.js to gtag.js is the best choice in most situations. However, if you want to keep data reporting that uses advanced UA features until the deprecation deadline, then you can have dual tagging on your site. Google provides more information for developers about dual tagging in Add Google Analytics 4 to an existing Universal Analytics implementation, and its Send events to both your UA and GA4 properties advanced guide provides a thorough overview of this type of implementation.

Can I keep using Google Tag Manager when I have GA4?

If you've been using Google Tag Manager to collect data for your UA setup, you can use it with GA4. However, you must be aware of certain considerations when implementing GA4 with Google Tag Manager. See Google's tips on this topic to learn more.