Note:
Our GA4 native integration is now available! Visit our GA4 documentation for steps on how to set up the integration. The UA Unbounce integration will stop working in Unbounce after July 1st (for all customers not signed up for a Google Analytics 360 plan).
Google Analytics is a powerful tracking tool that can be integrated with your Unbounce landing pages to collect data that helps to provide insight into your user activity.
This documentation will explain how to
- Integrate your landing pages with Google Analytics through
- Create a Google Analytics Conversion Goal Using Regular Expressions
- Track goals without a form confirmation dialog
- Customize Google Analytics Event Tracking with custom labels
- Analyze your page variants in Google Analytics.
What You'll Need
- A Google Analytics Account,
- An Unbounce account with live landing pages,
- A working domain or subdomain,
- Bot filtering enabled in Google Analytics (see the following paragraphs to learn more)
Estimated time to complete: 7-15 minutes.
Pro-tip
Before integrating with Google Analytics, please ensure that any Personally Identifiable Information (PII) is stripped out of the URL that Unbounce passes to Google Analytics, as per Google Policy.
Before you start, we recommend enabling bot filtering when using Google Analytics with Unbounce landing pages. Follow the steps in the screenshot below:
You may need to ask the owner of the Google Analytics account to set these permissions for you.
Integrating Landing Pages with Google Analytics (through Script Manager)
This implementation is best if you want Unbounce to automatically send data such as button clicks, link clicks, form submissions, and variant-specific tracking to your Google Analytics dashboard.
Step One: Retrieve Your UA Tracking ID from Google Analytics
Our current Google Analytics integration will only work with a UA property, not the new GA4 property.
When creating a Google Analytics account, Google will create a GA4 Property by default, so please follow the instructions to create a UA property.
See here for instructions: Setting up a UA Property.
Step Two: Enter your Website Tracking ID in Script Manager:
- Within the Unbounce App, select the Settings tab on the left-side menu bar.
- Select Script Manager from the list of Settings options.
- From Script Manager, click the button at the top-right to Add a Script, and select Google Analytics from the drop-down menu.
- Enter your UA Tracking ID (provided by Google Analytics), then click Add Script Details.
- A new page will appear with two panels:
- Script Details, and
- Script Usage
- In the Script Usage field, select which subdomain(s) you'd like to apply the Google Tracking Script to:
- Click Save and Publish Script.
You've now integrated Google Analytics with the selected subdomain and connected pages!
Manually Integrating Landing Pages with Google Analytics
As an alternative to the Script Manager option, it's possible to follow a manual method of integrating with Google Analytics on individual landing pages. This comes in handy with use cases that require customization to the Google Analytics script. Some examples are:
- Display feature tracking
- Custom dimensions
- Opting out of automated tracking
- Anonymize specific IP addresses in Google Analytics
To set this up, copy your UA-tracking script from Google Analytics. The script looks something like this:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-1234567890-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-1234567890-1');
</script>
Next, you can install the tracking script in the Classic Builder or Smart Builder.
Manually Install the Tracking Script in Classic Builder
- Click the Javascripts button at the bottom of your landing page in the Classic Builder.
- Paste the tracking script into the JavaScript widget.
- Under the Placement drop-down menu, select Head.
If you're using a Form Confirmation Dialog, you will need to install the tracking ID there as well.
- Click the Form Confirmation Dialog tab at the top of the Classic Builder.
- Click the Javascripts button at the bottom of the Classic Builder; paste the tracking code into the widget.
- Under the Placement drop-down menu, select Head.
Save and Republish your page.
Manually Install the Tracking Script in Smart Builder
Looking to integrate your Smart Builder page with Google Analytics? We have an Unbounce App for that! See our documentation for steps: Adding the Google Analytics App to Smart Builder.
Google Analytics will track metrics for your landing pages immediately, but these will not display in reports for about 24 hours.
Pro-tip
Active visitors on your page will be immediately visible in your Real-Time reports. Full visitor data populates to the rest of the reports roughly 24 hours later. For this reason, there is always an approximate 24-hour lag between stats collected in Unbounce and stats collected in GA.Creating a Google Analytics Conversion Goal Using Regular Expressions
Adding Goals in Google Analytics lets you track when you're hitting target objectives. If you're using the Unbounce Form Confirmation Dialog and would like to track form submissions as a Goal in Google Analytics, you can achieve that with regular expressions (regex).
A regular expression allows Google Analytics to track each variant on your landing page without you having to create a new goal for each variant. If you're using the Unbounce Form Confirmation Dialog for your pages, you can directly track form submissions as Conversion Goals in Google Analytics.
Head over to your Google Analytics account and follow these steps:
- In Google Analytics, navigate to the Admin tab, then open Goals.
- Create a new Goal.
- Under the Goal description tab, choose a Name for your Goal & select Destination (under Goal type).
- Under the Goal details tab, choose Regular Expression from the drop-down menu:
- Next, we'll type in a regular expression, depending on which domain or file path you'd like to track your goals for. Choose from the following regular expressions:
a) /.+-form_confirmation\.html
This regex formula will set a destination goal for all pages using a form confirmation dialog; it will count all visits to the form_confirmation.html URL on any variant or file path.
For example, to track submissions on "my.landingpage.io", as well as "my.landingpage.io/about-page/", my regular expression would be "/.+-form_confirmation\.html.”
b) /landing page path/.+-form_confirmation\.html
To narrow down the goal to an individual page with a specific file path/URL, specify a more defined variant before the regular expression. This regex allows you to specify any variant on a particular page path.
For example, if my landing page lives on "my.landingpage.io/landingpage", my regular expression would be "/landingpage/.+-form_confirmation\.html"
c) ^/.+-form_confirmation\.html
To track a goal for your landing page that lives at your root domain only (no additional page paths), use this regular expression.
For example, if my landing page lives at "my.landingpage.io," my regular expression would be "^/.+-form_confirmation\.html."
Here is an example of option b:
These regular expressions work best with tracking goals when using the Unbounce Form Confirmation Dialog and our native Google Analytics integration.
Track Goals without a Form Confirmation Dialog
Suppose you're hoping to track conversions in Google Analytics without the Unbounce Form Confirmation Dialog. In that case, you can either:
1) Create a Destination goal with the Confirmation Page's URL: This will treat a pageview as a conversion. In other words, when your page visitors land on an external thank-you page or confirmation page, the Goal is captured in Google Analytics.
Google Analytics needs to be installed on the external thank-you or confirmation page too. To set this up, paste in the thank-you/confirmation page URL and as your Destination URL. Google's documentation has more insight into destination goal tracking: Goal configuration options.
2) Track Form Submission Events using Event Tracking. This is a bit more complex but doable! The following section will go into more detail about events, and insight into setting up form submissions events as Goals.
Further information regarding Goals & Google Analytics:
Customizing Google Analytics Event Tracking
Follow the steps below to customize Google Analytics event tracking.
As mentioned, integrating your pages with our native Google Analytics integration via Script Manager will automatically send event tracking information for your page's action items directly into Google Analytics (such as button clicks, text link clicks, etc.).
You can also customize your Google Analytics event tracking by following the steps in this next section. To start, check out Google's documentation explaining the Anatomy of Events.
Below is an example of some of the custom events you can track:
If you manually installed Google Analytics onto your pages, you will need to set up manual event tracking before you can customize this data in Unbounce. See Setting Up Event Tracking in Google Analytics for Google's handy instructions on how to do this.
To explain Event Tracking, let's try out an example! Below is an example of how to set up event tracking for an Unbounce lead generation form and social sharing links on this page:
-
- To set up custom event tracking for these elements, start by copying the ID of each element you'd like to track within the Properties Panel of the builder:
- Next, click Javascripts within the Classic Builder to launch the Javascript widget.
- Copy & paste the following script into the blank field within the Javascript widget:
-
Update the following text within the code:
-
#lp-pom-ID-OF-ELEMENT or .lp-pom-CLASS-OF-ELEMENT: this will be the element ID or Class for which you'd like to track a custom event. IDs are more unique, so it may be best to use them for buttons or text links.
-
Here is a reference for some differences between Class and ID Selectors.
-
-
My Event Category: the Category parameter applies to all objects you'd like to group & analyze together.
-
For example, 'Forms,' 'Videos,' 'Outbound links', are examples of popular Categories.
-
-
My Event Action: the Action parameter explains what occurs once users interact with this element.
-
For example, 'Click,' 'Download,' 'Submit' are examples of popular Categories.
-
-
My Event Label: the Label parameter provides additional information to the Action; your Event Label value can be anything of your choice.
-
Some examples are 'Spring Campaign,' 'Sign-up Form,' or 'Request an E-Book,' etc.
-
-
- Using the above landing page as an example, here are the updated Event Categories, Actions & Labels:
Line 2 of this script uses a Class selector to reference the built-in Unbounce form (.lp-pom-form). Lines 3-5 uses ID selectors for the specific buttons (#lp-pom-text-349). - Select Before Body End Tag from the Placement drop-down menu.
- Click Done to save the script and repeat this for every page desired. Be sure to Save & Republish/Publish your landing page.
- To set up custom event tracking for these elements, start by copying the ID of each element you'd like to track within the Properties Panel of the builder:
You're all set! To view these events in Google Analytics Reports, navigate to Behaviour > Events > Reports Overview.
Track Form Submission Events as Goals
Tracking form submission events as Goals requires some additional setup steps in Google Analytics. The Event, Category, and Action Labels will need to match the values set up in Unbounce exactly.
For example, if the form ID in Unbounce is '#lp-pom-form-42' and you have not yet customized your event tracking using the above scripts, '#lp-pom-form-42' is the label you'd enter while configuring the Goal in Google Analytics.
However, if you have customized the event tracking using the provided script above and (as an example) have set the label to "Form," then "Form" is the label that will need to be used in the goal configuration.
You can find your events' unique values by testing your form, viewing the data within the Realtime Reports, or after waiting 24 hours for the data to fully process, then viewing the Behaviour > Events Reports tab in Google Analytics.
Analyzing Your Pages in Google Analytics
When integrating Google Analytics across your landing pages using the Script Manager integration, the variant letter appends to the end of the URL. For example, if my landing page URL is my.landingpage.io, with two active variants (A & B), then variant URLs will in Google Analytics appear as follows:
my.landingpage.io/a & my.landingpage.io/b.
So if you have additional file paths, the URLs in Google Analytics will be:
my.landingpage.io/about-page/a or my.landingpage.io/contact-us/b.
Next Steps
Setting up Referral Exclusion Lists & Subdomain Tracking
If you are using the same Google Analytics property to track page stats across different subdomains (for example, if visitors on 'my.landingpage.io' also visit the 'about.landingpage.io' domain), Google Analytics' system, by default, will count this as 2 pageviews on 2 separate sessions.
To remedy this, you can look into Referral Exclusions, which will prevent Google Analytics' system from tracking stats from subdomains at the start of a new session.
Once set up, the session that starts on 'my.landingpage.io' would continue even after users navigate to 'about.landingpage.io' (e.g., a different subdomain with the same root domain). This would translate to 1 session and 2 pageviews recorded for the visitor in Google Analytics, tracking the user's journey across subdomains.
To set this up, add a new view in Analytics, then follow Google Analytics' steps to set up Referral Exclusion lists. With Referral Exclusion lists, only one session will count per user.
Filters and Referral Exclusions
In conjugation with Referral Exclusions, you can apply an advanced & custom filter to your Google Analytics view, to better analyze your different subdomains/hostnames alongside page URLs in your reports.
By default, Google Analytics only displays your page URL, and does not include the hostname. For example, reports display page URLs like '/about-us,' or '/contact-us,' instead of 'about.landingpage.io/about-us,' or 'my.landingpage.io/contact-us.'
Advanced filters can be set up within the Admin page in Google Analytics to include both the hostname and page URLs.
Google's guide to Viewing Full Page URL In Reports demonstrates how to use filters to append the hostname to the landing page and page URLs in your reports.
To filter data within your reports directly, you can add a Secondary Dimension for 'Hostname' while in your Analytics reports. This will break down your page insights by URLs & domains only. Do note that setting up filters within the Admin page would be a long-term solution.
Cross-Domain Tracking
Since our native integration allocates only one UA tracking code set up at a time (the UA-code cannot be modified), cross-domain tracking is currently outside our support teams' scope.
While this can be set up by installing Google Analytics manually on your landing pages, setting up events and analyzing these customized reports requires an intermediate-level understanding of Google Analytics and Google Tag Manager. These custom reports can be error-prone since analyzing data in a property that tracks multiple domains can be tricky, making its setup something you would need to dabble with outside of Unbounce and our Support teams.
If you'd like to give this a try, here are some guides & resources to help point you in the right direction: Google's guide to measuring activity across domains (using Google Tag Manager), and step-by-step instructions on how to set up cross-domain tracking. For questions about implementing or setting up cross-domain tracking, post them directly on Google's Community forum.
Customizing Your Reports
Data collected from this integration is handled within your Google Analytics account. Check Google's site for information on building customized reports.
Related Articles
GA4 and Universal Analytics (UA) FAQ
Integrating with Google Analytics 4 (GA4)
Integrating Popups & Sticky Bars with Event Tracking in Google Analytics (GA4)