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)
- Log in to Unbounce, and from the left-hand side menu, click Settings.
- From the drop-down menu, select Script Manager.
- Click the blue Add a Script button on the top-right-hand corner.
- From the Add a Script window, select Google Analytics 4 from the drop-down menu.
- Paste your GA4 tracking ID in the empty field (also known as a Measurement ID):
- Click Add Script Details. A new page will appear to enter more Script Details:
- 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):
- Click Save and Publish.
- 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.
Note:
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:
- 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:
- Navigate to your landing page in the Classic Builder.
- Click the Javascripts button at the bottom of the Classic Builder.
- Give your script a name, such as 'GA4 Tag', and set the Placement to Head.
- Paste the GA4 tag in the script field. It should look like this:
- Click Done, and be sure to Save and Republish your page:
Note:
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:
- Click the Add Script to this Variant to add a second script.
- Paste in the event tracking script, and set the placement to Before Body End Tag:
- 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:
- Copy and paste the above script.
- Replace the existing GA4 Tag script from earlier steps with this script.
- Update this script by replacing G-XXXXXX with your GA4 tracking ID. It should look something like this:
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.
- In the Google Analytics platform, navigate to Admin -> Property -> Data Streams.
- Click on the data stream corresponding to your landing page.
- Toggle the Enhanced measurement button:
- To adjust which events you want to measure, click the gear icon and toggle the events from the Enhanced measurement window that appears:
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.
- In the Google Analytics platform, navigate to the Reports tab on the left-hand side.
- Under the Life cycle heading, click the Engagement drop-down menu, then Pages and screens. Then, select a Page path option:
- If you have a form on your page set up with a form confirmation dialogue, you can see which variant the user landed on:
- If you have a form on your page set up with a form confirmation dialogue, you can see which variant the user landed on:
Under the Page title tab, you might see the (not set) title:
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
Note:
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.
- In the Google Analytics platform, navigate to the Reports tab on the left-hand side.
- Under the Life cycle heading, click the Engagement drop-down menu, then Events, and click on the 'variant_id' event:
- Select variant_id as the Parameter Name:
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.
- Navigate to the Admin page in Google Analytics.
- Click Custom definitions.
- From the new tab that appears, click Create custom dimension.
- Set the Scope to Event and,
- Set the Event parameter to variant_id:
- 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.
- Click Save to finalize these changes.
To set up a report with the newly created custom dimension,
- Navigate back to the Explore tab.
- Click Free Form to set up a report with the newly created custom dimension.
- Under the Dimensions section, click the plus sign to add the new dimension:
- Select the dimension you created from the Custom section:
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:
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
- Log in to Unbounce, and from the left-hand side menu, click Settings.
- From the drop-down menu, select Script Manager.
- Click on the GA4 integration.
- Click Save Changes at the bottom of the script:
- 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)