Integrating Unbounce with Google Analytics 4 (GA4)


GA4 is Google's new tracking property designed to help you capture more information and insight into your page visitor's journey using event-based analytics. To learn more, see our handy FAQ.

On July 1st, 2023, Google will replace Universal Analytics (UA) properties with Google Analytics 4 (GA4). If you try creating a new property in Google Analytics (GA), a GA4 property will automatically be created. 

Updates: August 30th 2023

We recently implemented a change to support how Unbounce measures variants with GA4. You can now measure variants as events in GA4 under the event name 'variant_id.' To see this changed, re-save the GA4 integration and Script Manager and republish all pages. See the end of this doc for more steps. 

What You'll Need

  • A Google Analytics Account with a GA4 tracking setup,
  • An Unbounce account with live landing pages,
  • A working domain or subdomain,
  • A data stream in your GA4 property for your Unbounce landing page domain (be sure to select the Web option). 

Our teams are equipped to support you with implementing and setting up GA4 with Unbounce. If you have any questions about the GA4 platform, how to build custom Explore reports to segment your data better, or require more training in GA4, please get in touch with Google's support team. 

Installing GA4 in Unbounce (using the built-in integration)

  1. Log in to Unbounce, and from the left-hand side menu, click Settings
  2. From the drop-down menu, select Script Manager
  3. Click the blue Add a Script button on the top-right-hand corner. 
  4. From the Add a Script window, select Google Analytics 4 from the drop-down menu. 
  5. Paste your GA4 tracking ID in the empty field (also known as a Measurement ID):
    GA4 measurement ID.
  6. Click Add Script Details. A new page will appear to enter more Script Details
  7. From the Script Usage tab, select the domain you want the GA4 tag to apply to (i.e., GA4 will collect analytics for these landing pages):
    Red arrow pointing to domain.
  8. Click Save and Publish.  
  9. After adding the integration, republish your landing pages to ensure that the integration starts sending data to GA4.

Once you republish your pages, data and page metrics will appear in Google Analytics 24 hours later. 

You're all set! You've now set up the GA4 integration with Unbounce pages.


Please republish your pages after installing the GA4 integration. Pages that haven't been republished since February 3rd, 2023, will only work with the integration once they have been republished.

Installing GA4 in the Classic Builder (manual installation) 

In GA4, you can have multiple data streams per property, so you can integrate GA4 once in Unbounce without worrying about integrating it for every page. However, you still have the option to install GA4 manually on pages in the Classic Builder.

To install GA4 manually within the Classic Builder, you'll need:

  1.  The default GA4 installation code (installed to the head).
    • Optional: Additional custom script - shared below -  to track form submissions and variants

The Javascripts widget in the Classic Builder is a great way to add custom scripts to individual pages. Here is how to add your GA4 script to Classic Builder pages:

  1. Navigate to your landing page in the Classic Builder. 
  2. Click the Javascripts button at the bottom of the Classic Builder.
  3. Give your script a name, such as 'GA4 Tag', and set the Placement to Head.
  4. Paste the GA4 tag in the script field. It should look like this:
    GA4 tag script installed in JavaScript widget.
  5. Click Done, and be sure to Save and Republish your page:


Please republish your pages after installing the GA4 integration. Pages that haven't been republished since February 3rd, 2023, will only work with the integration once they have been republished.

Optional: Capturing Form Submission events

To capture form submission events while setting up the manual installation, you'll need to create another custom script. To start, copy this script:

  1. Click the Add Script to this Variant to add a second script.
  2. Paste in the event tracking script, and set the placement to Before Body End Tag:
    Form submission tracking script installed in Javascripts widget.
  3. Click the blue Done button to add the script.

Optional: Set up Variant tracking as events in GA4

You can edit the GA4 tag script created in step 1 to measure variant tracking in GA4: 

  1. Copy and paste the above script.
  2. Replace the existing GA4 Tag script from earlier steps with this script.
  3. Update this script by replacing G-XXXXXX with your GA4 tracking ID. It should look something like this: 
    GA4 tag with variant tracking script in JavaScripts widget.

 Be sure to Save and Republish your landing page.

Enabling Enhanced Measurements in Google Analytics

GA4 helps you capture actions on your page through events.

An event in GA4 refers to any interaction on your website, such as a page load, button click, video play, form submission, etc.

GA4 automatically captures events on your page by default. However, you can also adjust the settings in Google Analytics to capture more enhanced measurements. To do so, you must enable Enhanced Measurements in your Google Analytics 4 property data stream.

  1. In the Google Analytics platform, navigate to Admin -> Property -> Data Streams.
  2. Click on the data stream corresponding to your landing page.
  3. Toggle the Enhanced measurement button:
    Enhanced measurements in GA4.
  4. To adjust which events you want to measure, click the gear icon and toggle the events from the Enhanced measurement window that appears:
    Toggle radio buttons for the different enhanced measurement options in Google Analytics.

Some common events that you may want to track on your Unbounce pages are:

  • Page views
  • Scrolls
  • Outbound clicks
  • Form interactions
  • File downloads
  • Video engagement

Click the Save button at the top to finalize these changes. 

Tracking Page Views in GA4

Follow these steps to access your page view metrics in GA4. 

  1. In the Google Analytics platform, navigate to the Reports tab on the left-hand side.  
  2. Under the Life cycle heading, click the Engagement drop-down menu, then Pages and screens. Then, select a Page path option:
    Pages and screens reporting tab in Google Analytics.

Under the Page title tab, you might see the (not set) title:
Page title column in Pages and screens tab.

To remedy this and ensure that a clear page title appears in Google Analytics, update the Page Title metadata settings on your landing pages back in Unbounce. Then, Google Analytics will start collecting the page titles: 

Updating Page Settings & Metadata in Smart Builder 

Managing your Page Properties in the Classic Builder - The Title & Metadata Section 

Variant Tracking in GA4


At this time, automated variant tracking only works if you've set up the built-in GA4 integration. If you've set up your GA4 integration via Google Tag Manager (GTM), variant tracking is currently unavailable.

If you run an A/B test or have Smart Traffic enabled on your page, you may want more granular data to see how your page variants perform.

The Unbounce integration passes through a 'variant_id' event, which contains the Unbounce page variant letter.

To view page variant reports, follow these steps.

  1. In the Google Analytics platform, navigate to the Reports tab on the left-hand side.
  2. Under the Life cycle heading, click the Engagement drop-down menu, then Events, and click on the 'variant_id' event:
  3. Select variant_id as the Parameter Name:
    Parameter name drop-down menu.

Note: This data will only show events within the last 30 minutes. 

Setting up Custom Reports in GA4 

Custom reports (also known as Explorations in GA4) provide advanced reporting insights to help you segment data better. 

Explorations are a new feature introduced with Google Analytics 4, and there are many ways to mock up reports to get insight into different metrics, segments, and dimensions.

For example, we'll set up a custom report to track page variants. To start, we'll set up a Custom Dimension. This custom dimension will collect data about page variants only. 

  1. Navigate to the Admin page in Google Analytics. 
  2. Click Custom definitions.
  3. From the new tab that appears, click Create custom dimension.
    • Set the Scope to Event and,
    • Set the Event parameter to variant_id:
      New custom dimension tab in Google Analytics.
      • You can set the event parameter to another option depending on what focused dimensions you want to track. For this example, we'll use variant_id.
  4. Click Save to finalize these changes.

To set up a report with the newly created custom dimension,

  1. Navigate back to the Explore tab.
  2. Click Free Form to set up a report with the newly created custom dimension.
  3. Under the Dimensions section, click the plus sign to add the new dimension:
    Add a new custom dimension.
  4. Select the dimension you created from the Custom section:
    Select custom dimension created.

You can then drag the dimension under the rows or columns to add it to the chart.

If you see the (not set) value instead of a variant letter, that means the event came from a form confirmation dialog or a lightbox:
Custom report in Google Analytics.

Creating custom Explore reports and dashboards is outside the scope of support from Unbounce.

Google's support team or a member of your team who's versed in Google products can help you build out these reports with what you're looking to measure or explore. 

Updating the GA4 Integration

Our teams are constantly looking into ways to improve the GA4 experience with Unbounce.

Our most recent feature enhancement includes improved reporting when tracking variants in GA4. 

To ensure that the version of GA4 that you're using is most up-to-date, please complete the following changes: 

Resave the GA4 Script

  1. Log in to Unbounce, and from the left-hand side menu, click Settings
  2. From the drop-down menu, select Script Manager
  3. Click on the GA4 integration. 
  4. Click Save Changes at the bottom of the script:
    Save button in Script Manager for GA4 integration.
    • No need to edit or make changes to it; re-saving it from this page will recalibrate the integration. 

Generally, we recommend republishing your pages if you're setting up the GA4 integration for the first time.

Once you republish your pages, data and page metrics will appear in Google Analytics 24 hours later. 

It takes Google Analytics roughly 24 hours for the data to populate. 

Related Articles

GA4 and Universal Analytics (UA) FAQ

How to Set up Conversion Tracking for Unbounce Forms in GA4

Integrating Popups & Sticky Bars with Event Tracking in Google Analytics (GA4)