Foleon allows you to measure the performance of your Foleon Docs. Next to our built-in analytics, we also enable you to connect your Foleon Docs to Google Analytics 4 (GA4). This article shows you how to connect Foleon to GA4.
⚠️ On July 1, 2023, Google Analytics 4 replaced Google’s Universal Analytics (UA). If you haven't already, we recommend migrating your data to GA4 to avoid missing out on data. You can still access the previously processed data of your Universal Analytics property until July 1, 2024. We recommend you export your historical reports before this date.
In this article
- What is Google Analytics?
- Connect GA4 to Foleon
- What does Google Analytics track?
- Set up cross-domain measurement
What is Google Analytics?
Google Analytics is a free web analytics tool offered by Google to help you analyze your website traffic. It’s the most widely used web analytics service on the web.
Simply put, Google Analytics records various activities of visitors when they visit a website, along with the attributes (such as age, gender, and interests) of those visitors. It then sends all that information to the Google Analytics servers once a visitor leaves a website.
💡In order to analyze the performance of our platform, we also include our own Google Analytics code (UA-36092362-3) in every published Foleon Doc. IP addresses are anonymized by default for this property.
Connect GA4 to Foleon
Step 1: Make sure you have a Google Analytics account
If you haven’t already, you can easily create a Google Analytics account by following these instructions from Google (it’s free!):
Step 2: Set up a property
Once you’ve created an account (or have logged in to an existing account), you can connect GA4 to Foleon.
Google Analytics works with so-called “Properties”; these allow you to split up data if you’re using the same Google Analytics account for different websites.
💡 We recommend that you create a separate property for each project in Foleon. This allows you to compare different Foleon Docs within a project without needing to filter out data from Foleon Docs in other projects.
As part of the property setup, you must add a data stream so your property has a data source. This is how data flows from the domain on which you host your Foleon Doc(s) to the property.
For each separate property you create, add the URL of the project as your data stream. Depending on your hosting setup, that would be:
Publishing on a Foleon domain:
Publishing on a custom domain:
- If only using it for one project: e.g.,
- If using it for multiple projects (including base path): e.g.,
- If only using it for one project: e.g.,
If you want to analyze the performance of individual Foleon Docs in your project, learn more in our article Using Google Analytics 4 (GA4) comparisons to analyze a single Foleon Doc.
If you haven't created a property yet, follow these instructions from Google:
Step 3: Get your tracking "G-" measurement ID
Once you’ve created a GA4 property for your project, you retrieve the tracking “G-” measurement ID to connect Google Analytics to Foleon.
Follow these instructions from Google to find your Google Analytics 4:
1. Sign in to your Google Analytics account.
2. Click Admin.
3. At the top of the Property column, select your property.
4. In the Property column, click Data streams.
5. Click the data stream for which you need the ID.
6. Your "G-" ID appears in the top right. Copy the ID to your clipboard.
Step 4: Add your tracking code to Foleon
Once you’ve created a Google Analytics property for a specific project, go to the Foleon dashboard. From the projects menu, select the project you want to connect to the Google Analytics property (or create a new project).
Next, open the project settings.
Scroll down to the Google Analytics section.
Insert your measurement ID within Google Analytics 4 (GA4). If you want to check the advanced settings, continue to step 5. If you’re okay with the default settings, click Save. That’s it.
⚠️ Do you already have live Foleon Docs in the project? Republish all live Foleon Docs in the project for the changes to take effect.
You’ve now connected the Google Analytics property to all Foleon Docs in this project. If you’ve created several properties for different projects, repeat this process for each project.
📖 If you want to analyze the performance of individual Foleon Docs in your project, learn more in our article Using Google Analytics 4 (GA4) comparisons to analyze a single Foleon Doc.
Step 5 (optional): Check the advanced settings
When you click advanced settings, you’ll see two additional options. You can change these settings if your Google Analytics setup requires a custom approach.
⚠️ If you’re unsure, we recommend not changing these options unless it’s necessary, as the default settings provide you with the most insights from Foleon-specific events.
Before changing these toggles, check your enhanced measurement options in GA4. We go over these two settings below:
Send additional engagement events to GA4 — ✅ This toggle is on by default.
If enabled, you enrich your GA4 data with Foleon-specific events (e.g., clicks on navigation and overlays). This helps you analyze and visualize how your audience reads your Doc.
We recommend keeping this enabled to make the most of your analytics. You could, for example, disable this if you prefer to stick to the generic Google Analytics 4 events.
Let Foleon detect and track page changes instead of GA4 — ❌ This toggle is off by default and can cause duplicate data if turned on.
We recommend keeping this disabled to ensure GA4 is responsible for tracking page changes.
Foleon Docs are single-page applications(SPA). This means content changes dynamically, and a page change is simulated. In reality, you've stayed on the same page. That's why the Foleon platform and Foleon Docs require only a single page load, ensuring loading speed while navigating the content.
By default, GA4 detects and tracks these simulated page changes. Only if you have disabled GA4 to track simulated page changes automatically, then we recommend enabling this toggle. If enabled, Foleon will detect and track whenever a reader changes to another page changes.
If you want to enable this option in Foleon, you'll have to ensure you have the correct setup in Google Analytics 4 to avoid duplicate data.
First, in GA4, click admin, and then data streams.
Open up your web data stream.
Next, click the gear icon to open the enhanced measurement settings.
Click show advanced settings under page views. If both boxes are checked, we recommend not enabling Let Foleon detect and track page changes instead of GA4.
What does Google Analytics track by default?
Google Analytics keeps track of many metrics, such as pageviews, button clicks, and scroll depth. At its most basic level, it collects:
- Duration of visit, pages visited, and time spent on each page
- Referring site details
- Type of web browser
- Type of operating system
- Network location and IP address
As you can tell, it enables you to see how the content on your site is performing, but it also gives you access to detailed information on your site's visitors.
To track visitors of your Foleon Doc, Google Analytics places cookies. The _ga cookie placed by Google has an expiration date of two years and is used to distinguish users. To change your default cookie settings in Google, we recommend you read Google's documentation on this topic. To learn more about all the cookies that Foleon places, read our article All about Foleon and GDPR.
Under the GDPR, an IP address is considered personal data because it can be used to identify a person. You may want to anonymize IP addresses, so they’re not recorded in Google Analytics. You can do this in Doc settings > Marketing > Anonymize IP.
⚠️ A Doc's preview link (e.g., https://example.viewer.foleon.com) is not tracked with Google Analytics. To see data in Google Analytics, share the URL of your published Foleon Doc (e.g., https://example.customdomain.com).
Next to the standard analytics, we also keep track of a wide range of events in Foleon Docs (e.g. button clicks, scroll depth). We’ll talk about this more in-depth in the article: Getting further insights with Google Analytics events.
Set up cross-domain measurement
Google's cross-domain measurement, also referred to as cross-domain tracking, allows activity to be accurately attributed to a single visitor as they cross domains.
When cross-domain measurement is set up, the visitor's cookies remain the same as they navigate from one domain to another — for example, they open a Foleon Doc from a form on your main website. As a result, Google Analytics identifies just one visitor and one session.
Cross-domain measurement in GA4 is compatible with our native Google Analytics integration. This helps you capture analytics data correctly when visitors go from your website to a Foleon Doc (or vice versa) when they both have a (or the same) GA4 property installed.
Depending on your data-gathering strategy and how Foleon Docs play their part, you can decide if you want to set up cross-domain measurement. Two examples:
- You want a visitor of your website that opens a Foleon Doc from a link to be considered one visitor — not two.
- You want to separate the data from your main website and your Foleon Doc by setting up different GA4 properties.
💡 To learn how to set up cross-domain measurement, we recommend you read Google's documentation.