How to Set Up Google Analytics 4 (GA4): A Comprehensive Guide

19 min
read
25-08-2023

Google Analytics 4 (GA4) is the latest version of Google's powerful web analytics tool, designed to help website owners and businesses better understand their audience and drive data-driven decision-making. You can bring data from many sources, including Google Search Console, to get the best data for your business. This comprehensive guide will walk you through the process of setting up Google Analytics 4 (GA4) and leveraging its capabilities to grow your website and business.

Creating a GA4 Property

GA4 properties are the latest version of Google Analytics properties that offer a more comprehensive and flexible way of organising and managing the data collected from your website and mobile app. Unlike a Universal Analytics property, GA4 properties use an event-based model that allows you to track and measure any user interaction on your site or app.

By creating a GA4 property, you are setting up a foundation for tracking and analysing user interactions on your site or app. You can also link your GA4 property to your Google Ads account to get better insights into your advertising performance and conversion tracking.

Another of the benefits of GA4 properties is that they can be used for both web and app analytics. If you have a mobile app, you can integrate it with Firebase, Google’s platform for app development and growth. By linking your Firebase project to your GA4 property, you can access all the data from your app in your Google Analytics account and get a unified view of your users across platforms.

How do I get started with GA4?

To create a new GA4 property, follow these steps:

  1. Create a new GA4 property: Log in to Google Analytics page and navigate to the admin section. Click on “Create Property” to start the process.

  2. Name your property: Give your property a descriptive name to help you easily identify it among multiple properties.

  3. Create a web data stream: Set up a data stream to send information from your website to your GA4 instance. You can choose to enable Enhanced Measurement for more detailed interaction tracking.

  4. Find your measurement ID: After creating your data stream, locate the Measurement ID in the stream settings. You’ll need this to set up your GA4 configuration tag.

  5. Create a GA4 configuration tag through GTM: Using Google Tag Manager (GTM), create a tag with your Measurement ID and an all-page trigger to ensure the tag fires on every page. We strongly recommend GTM, but there are other options, such as manual configuration and working through your CMS.

  6. Create and test the new tag: Test the tag using GTM’s preview mode to confirm it’s firing as expected. You can also use GA4’s DebugView for a more in-depth review of interactions.

Installing the GA4 Tracking Code

Tracking ID codes are essential for sending data from your website to your GA4 property. To install the GA4 tracking code on your site, you have several options depending on your preferences and technical skills.

Methods for installing the GA4 tracking code

Manual code insertion

You can add a small JavaScript snippet to your site’s header or footer. You can find the Google Analytics tracking code in your GA4 property’s data stream settings. This method is simple and straightforward, but it requires access to your site’s source code and may not be compatible with some CMS platforms.

Using a CMS plugin

Another option is using a plugin or extension that supports GA4 for your CMS platform, such as WordPress, Shopify, or Wix. You can find a list of compatible plugins on the Google Analytics Help Center. This method is convenient and easy, but it may not offer full customization and control over your tracking code settings. The Shopify built-in ga4 integration is one of the better examples of using a CMS.

How to set up GA4 in GTM (Google Tag Manager)

The best method involves using Google Tag Manager (GTM), a free tool that allows you to manage and deploy tags on your website without editing the code. You can create a GA4 configuration tag in GTM with your measurement ID and an all-page trigger to ensure the tag fires on every page.

Troubleshooting your Google Analytics code

Regardless of which method you choose, you should always test and verify your tracking code installation to make sure it’s working properly. Issues sometimes arise in google analytics vs google tag manager, so you should check them. You can use several tools to troubleshoot common issues faced during the tracking code installation process, such as:

  1. GTM’s preview mode: This tool allows you to see which tags are firing on your website and what data they are sending to Google Analytics.

  2. GA4’s DebugView: This tool allows you to see real-time events and parameters from your website in your GA4 property.

  3. Google Tag Assistant: This tool allows you to check the status and validity of your tags on any web page.

If you have multiple tracking codes on your web pages, such as GA4 and standard Universal Analytics properties, you should follow some best practices to handle them correctly:

  1. Avoiding duplicate or conflicting tags: You should make sure that each tag has a unique ID and that they are not sending the same data to the same property.

  2. Using connected site tags: You can use the GA4 Setup Assistant to create a connection between your Universal Analytics and GA4 properties. This will allow you to reuse your existing Universal Analytics tagging for your GA4 property without adding any additional code. We recommend using this when there is nothing else.

  3. Using tag priority: You can use GTM’s tag priority feature to control the order in which your tags fire on your website. This can help you avoid potential issues with tag dependencies or conflicts. Or you can use tag sequencing - Tag sequencing enables you to specify tags to fire immediately before or after a given "primary" tag is fired. This advanced option could give you better data about events on your website.

Claim Your Free Audit to Uncover Hidden Opportunities

Configuring GA4 Settings

GA4 settings allow you to customise and optimise your data collection and analysis according to your business needs and goals. You can access and manage your GA4 settings using the Setup Assistant in your GA4 property.

How do I set up GA4 configuration?

To set up a GA4 configuration, you need to do the following steps:

  1. Create a Google Analytics 4 property in your Analytics account.

  2. Add a web data stream for your website and get the measurement ID.

  3. Create a Google Analytics: GA4 Configuration tag in Google Tag Manager and enter the measurement ID.

  4. Configure any fields or parameters you want to set for your GA4 tags.

  5. Trigger the GA4 Configuration tag on all pages where you want to collect data.

This is a very quick overview of the process. For more help, reach out to one of our data analysis experts at Optimum Click.

Why adjust your settings?

Let’s take a look at each setting available in GA4, and examine why you could tweak them and impact on data collection:

  1. Adjusting session timeout settings: A session is a group of user interactions that take place within a given time frame. By default, GA4 ends a session after 30 minutes of inactivity or at midnight. You can modify the default session timeout settings in GA4 to better align with the average user engagement on your site.

  2. Filtering internal and developer traffic: Internal and developer traffic refers to the visits from your own team or contractors who work on your site. This type of traffic can skew your data and affect your analysis. You can set up filters to exclude traffic from internal and developer IP addresses to ensure accurate data collection.

  3. Listing unwanted referrals: Referrals are sources that send traffic to your site, such as other websites, social media platforms, or email campaigns. However, not all referrals are relevant or desirable for your site. Some referrals may be spammy, malicious, or unrelated to your site’s content. You can exclude unwanted referral traffic to prevent skewed data and better understand the sources driving traffic to your site. Your own landing pages might be another example of traffic to exclude.

  4. Setting up cross-domain tracking: Cross-domain tracking allows you to track users who navigate between multiple domains that belong to you. Here’s what to do: Include separate domains that contain “yourdomain.co.uk” and “mydomain.co.uk”, etc domains.This does not include subdomains because these are tracked automatically.

  5. Reviewing enhanced measurement events: Enhanced measurement is a feature that automatically captures certain types of user interactions on your site without requiring any additional code or configuration.

In addition to these settings, you can also create and manage custom events, goals, and conversions in GA4.

  1. Custom events are user interactions that are not captured by enhanced measurement or automatically collected events.

  2. Goals are specific actions that you want users to complete on your site, such as signing up for a newsletter or completing a purchase.

  3. Conversions are goals that have high value for your business and are used for optimization and reporting purposes.

Here are a few examples of how tweaking your settings could help your data quality.

  1. By adjusting your session timeout settings, you can get a more accurate picture of how engaged your users are with your site’s content.

  2. Filtering out internal and developer traffic helps avoid inflating your metrics and lets you focus on real users.

  3. You can list unwanted referrals. Doing this could eliminate noise and help clarify the sources that bring valuable traffic to your site.

Enhanced Measurement in GA4

Enhanced Measurement is a feature that automatically captures certain types of user interactions on your site without requiring any additional code or configuration. These include page views, scrolls, outbound clicks, site search, video engagement, file downloads, and form interactions.

To enable and customise Enhanced Measurement, navigate to the data stream settings in your GA4 property and toggle on the desired features. Here is a detailed breakdown of each Enhanced Measurement feature, its benefits, and how to interpret the data collected:

  1. Page views: This feature tracks each time a user loads or reloads a page on your site. It also tracks browser history events such as pushState, popState, and replaceState. This feature is enabled by default and cannot be turned off. The page view event populates the Views metric and the Page location and Page referrer dimensions.

  2. Scrolls: This feature tracks the first time a user reaches the bottom of each page (i.e., when a 90% vertical depth becomes visible). This feature helps you measure how engaged users are with your content and whether they scroll down to see more information. The scroll event populates the Percent scrolled dimension.

  3. Outbound clicks: This feature tracks each time a user clicks a link that leads away from the current domain. This feature helps you measure how users navigate from your site to other sites and whether they follow your calls to action or recommendations. The click event populates the Link classes and Link domain dimensions.

  4. Site search: This feature tracks each time a user performs a search on your site using a query parameter (e.g., ?q=keyword). This feature helps you measure what users are looking for on your site and whether they find relevant results. The view_search_results event populates the Search term dimension.

  5. Video engagement: This feature tracks each time a user interacts with a video on your site using standard HTML5 video elements. It tracks events such as video_start, video_progress (at 25%, 50%, 75%, and 100%), video_complete, and video_abandon.

  6. File downloads: This feature tracks each time a user downloads a file from your site with one of the many common file types. This feature helps you measure what types of files users are interested in and whether they download them successfully. The file_download event populates the File name and File extension dimensions.

  7. Form interactions: This feature tracks each time a user interacts with a form on your site using standard HTML form elements. It tracks events such as form_start (when a user enters data in any field), form_submit (when a user submits the form), and form_abort (when a user leaves the page without submitting the form). This feature helps you measure how users engage with your forms and whether they complete them or abandon them. The form_* events populate the Form ID and Form classes dimensions.

You can also integrate GA4’s Enhanced Measurement data with other marketing tools and platforms for a more comprehensive analysis. For example, you can:

  1. Link your GA4 property to your Google Ads account to get better insights into your advertising performance and conversion tracking. You can also bid on GA4 conversions and target ads to GA4 audiences.

  2. Send data through Google Tag Manager account to GA4 to manage and deploy tags on your website without editing the code. You can also create custom events and parameters using Google Tag Manager. This data becomes available in GA4.

  3. Link your GA4 property to your BigQuery account to export and analyse your raw data in a cloud-based data warehouse. You can also join your GA4 data with other data sources and run advanced queries and reports.

Registering Custom Dimensions

Custom dimensions allow you to collect additional data about users and their interactions on your site that are not available by default in GA4. For example, you can collect data such as user loyalty level, product category, or coupon code.

To register a custom dimension in GA4, follow these steps:

  1. Create the custom dimension in GA4: Navigate to “Custom Definitions” in the “Configure” section of your GA4 property and click “Create Custom Dimension.” For example, if you want to create a custom dimension for user loyalty level, you can name it “Loyalty Level” and assign it a unique index number.

  2. Name and describe your dimension: Provide a name and description for your custom dimension to help you easily identify it later. For example, you can describe your loyalty level dimension as “The level of loyalty of a user based on their purchase history.”

  3. Set the scope: Choose the appropriate scope (Event, User or Product ) for your custom dimension based on the data you’re collecting. The scope determines how long the custom dimension value persists and how it is associated with other data. For example, if you choose the User scope for your loyalty level dimension, the value will persist for the lifetime of the user and will be associated with all events performed by that user.

  4. Implement the custom dimension in your tracking code: Modify your GA4 tracking code or GTM configuration to send the custom dimension data to GA4 with each relevant event. For example, if you want to send the loyalty level data with each purchase event, you can add a parameter called “loyalty_level” with the value of the user’s loyalty level (e.g., “Bronze”, “Silver”, “Gold”) to your purchase event code or tag.

  5. Audience creation: Use your custom dimensions to create more targeted audiences for remarketing and personalization efforts. For example, you can create an audience of users who have a loyalty level of Gold and who have visited your site in the last 30 days. You can then use this audience to show them special offers or discounts to encourage repeat purchases.

  6. Audience triggers: In Google Analytics 4 (GA4), conversions are tracked every time they occur, even within the same session. If you prefer to track conversions once per session, like in Universal Analytics, you can use Audience Triggers. Create a custom audience that includes sessions with session_start event followed by your desired event. Configure the audience to dispatch an audience trigger, generating a custom event called au_generate_lead_once_per_session. Then, register this event as a conversion in GA4. This method allows you to track conversions once per session, despite GA4's default settings.

Managing Data Retention and Privacy

Changing Data Retention Settings

Adjust data retention settings in GA4 to balance data storage needs and privacy requirements. Data retention settings control how long user-level and event-level data is stored by Google Analytics before being automatically deleted. You can choose between two options: 2 months or 14 months. The shorter retention period is always applied to age, gender, and interest data regardless of your settings. Changing the retention period affects only the data collected after the change. Data retention settings do not affect standard aggregated reports, but only Explorations.

Ensuring GDPR and Privacy Compliance

Review and implement necessary measures to comply with privacy regulations like GDPR, CCPA, or other applicable laws. This may include anonymizing IP addresses, obtaining user consent, or managing data deletion requests.

GA4 does not log or store individual IP addresses, but only provides coarse geo-location data derived from them. GA4 also collects all data from EU-based devices through domains and servers based in the EU before forwarding traffic to Analytics servers for processing. You can use regional controls to disable collection of Google-signals data or granular location and device data on a per-region basis. You can also use Google Consent Mode to modify the behaviour of Google tags on your website based on the user's consent preferences.

Additionally, you should create a privacy policy that informs your website or app users about how you use GA4 and how they can exercise their rights under the GDPR or other laws. You can use a privacy policy generator to create a customised privacy policy for your business.

Exploring Data Export Options

Learn how to export your GA4 data to other platforms or tools for further analysis or data backups. GA4 allows you to export your data to BigQuery, a cloud-based data warehouse that lets you run SQL queries on large datasets.

You can also export your data to Google Data Studio, a free tool that helps you create interactive dashboards and reports. Alternatively, you can use the Analytics Data API to access your GA4 data programmatically and integrate it with other applications or services.

Reviewing and Adjusting Attribution Settings

Attribution settings in GA4 determine how credit is assigned to marketing channels for conversions. To review and modify attribution settings, navigate to the “Conversions” section of your GA4 property and click “Attribution.” You can adjust the following settings:

Reporting attribution model

This is the attribution model that is used to calculate conversion credit in your reports within your Analytics property, and also within the conversion reports of any linked Firebase projects. You can choose from data-driven attribution, cross-channel rules-based models, or the Ads-preferred last click model. Data-driven attribution uses machine learning algorithms to evaluate both converting and non-converting paths and assign credit based on data for each conversion event. Cross-channel rules-based models use predefined rules to distribute credit among touchpoints on conversion paths.

Lookback windows for conversion events

These are the time periods that are used to include or exclude touchpoints from conversion paths based on when they occurred relative to the conversion. For example, if you set the lookback window for acquisition conversion events to 7 days, only the touchpoints that occurred within 7 days of a user’s first visit will be considered for attribution.

Regional controls for Google-signals data and granular location and device data

These are the options to enable or disable collection of certain types of data on a per-region basis. For example, you can disable collection of Google-signals data for regions where you need to comply with privacy regulations like GDPR or CCPA. Google-signals data includes cross-platform reporting, remarketing lists based on Analytics data, advertising reporting features, or demographics and interests. You can also disable collection of granular location and device data, such as city, browser minor version, device brand, or screen resolution.

Conclusion

With GA4 set up and configured, you're now equipped with a powerful tool to analyse your website's performance and user behaviour. By leveraging GA4's capabilities, you can make data-driven decisions to drive growth and success for your website and business. Don't hesitate to dive in and explore the wealth of insights GA4 has to offer.

If you won’t know where to begin, contact our experts at Optimum Click. We can start with a free data analytics service review. Based on what we find, we’ll work with you to customise your analytics so you see the best data you need to make smart decisions.

Claim Your Free Audit to Uncover Hidden Opportunities

FAQ

Share this article!

Copy the link of this page
Copy URL to Clipboard
Share to Twitter
Share it on Twitter
Share to Facebook
Share it on Facebook
Share to LinkedIn
Share it on LinkedIn
Share to Email
Share it via email

Author of the article

GÁBOR Cseh

PPC Expert & Data Analyst

Family-man Gabor is in it for the long run. Whether that’s in sport, with his Garmin watch tracking every metre, every kilometre, or in business, where his long term digital marketing strategies shape ongoing online success over months and years.

For Gabor - success all about the journey.

  • 9 years experience in online marketing

  • Google Ads (Search, Shopping, Display, YouTube)

  • Google Analytics

  • Google Tagmanager

  • Data Studio

  • Facebook and LinkedIn Ads

Serious online marketing for serious online sales