How to install Google Analytics 4 for your website? (3 Different Methods)

Data AnalyticsOur Guides

Google Analytics 4 (GA4) is Google’s latest and most advanced analytics platform, giving you powerful insights into how users interact with your website or app. Ready to get started with GA4? In this guide, we’ll show you three simple ways to install it: through Google Tag Manager (GTM), by integrating it with your current platform, or by manually adding it yourself. Each option has its own perks, and we’ll walk you through each step to help you choose the best one for your needs.

Method 1: Install GA4 with Google Tag Manager (GTM)

Google Tag Manager (GTM) is an efficient way to manage all your tracking tags without needing to constantly edit your website’s code. If you’re already using GTM, adding GA4 is a simple process.

Step-by-Step Guide:

1. Locate your GA4 Property Measurement ID:
  • Sign in to your Google Analytics account.

  • Click on “Admin” in the lower-left corner.

  • Under “Data collection and modification”, select your web data stream and locate your Measurement ID:

2. Set Up a New Tag in Google Tag Manager:
  • Log in to your Google Tag Manager account.

  • In the workspace, click on “Tags” and then “New.”

  • Name your tag something relevant (e.g., “GA4 Configuration”).

3. Add GA4 Configuration:
  • Click on “Tag Configuration”, select “Google Analytics” then select “Google Tag”.

  • Enter your Measurement ID (you can find this in GA4 under Admin > Data Streams > Web) – See Step 1.

  • Set the trigger to “All Pages” to ensure the tag fires across your entire site.

4. Publish Your Tag:
  • Click “Submit” to publish the tag.

  • Once live, GTM will send data to your GA4 property.

Why Use GTM?

  • It allows you to manage all your tags in one place.

  • There’s no need to edit your website’s code once GTM is installed.

  • GTM makes it easy to add and update other tracking tags in the future.

Method 2: Install GA4 Using a Built-in Integration/Plugin

If your website is on platforms like Shopify, WordPress, or Wix, they typically offer built-in/plugin integrations with Google Analytics. This method is ideal if you’re looking for a simple, no-fuss way to set up GA4.

Step-by-Step Guide (Shopify):

1. Locate your GA4 Property Measurement ID:
  • Sign in to your Google Analytics account.

  • Click on “Admin” in the lower-left corner.

  • Under “Data collection and modification”, select your web data stream and locate your Measurement ID:

2. Access Your Platform’s Analytics Settings:
  • In your Shopify, WordPress, or Wix dashboard, navigate to the settings section for analytics or tracking.

  • Find the option to integrate Google Analytics and click on it.

3. Enter Your GA4 Measurement ID:
  • Paste your Measurement ID from GA4 into the relevant field.

  • Save the settings to ensure tracking is enabled.

4. Verify the Setup:
  • Go back to your Google Analytics account and check the real-time data to ensure users are being tracked.

Why Use a Platform Integration?

  • It’s quick and easy—no technical skills required.

  • The platform handles most of the setup for you.

  • You avoid the need to add or modify code.

Method 3: Install GA4 Manually (Adding Code Directly)

If you prefer to take a hands-on approach or your website platform doesn’t have a built-in integration, you can manually install GA4 by adding the tracking code to your site’s HTML.

Step-by-Step Guide:

1. Create Your GA4 Property:
  • Just like the previous methods, start by creating a GA4 property and getting your Measurement ID.

2. Obtain the GA4 Tracking Code:
  • In GA4, go to Admin > Data Streams > Web, and select your data stream.

  • Click “View Tag Instructions” and copy the tracking code provided.

3. Add the Code to Your Website:
  • Open your website’s HTML file or access the HTML through your content management system (CMS).

  • Paste the GA4 tracking code just before the closing </head> tag on every page you want to track.

  • If your website uses a template, adding the code to the template file will apply it across all pages

4. Test Your Setup:
  • After saving your changes, visit your GA4 account and check the real-time data to ensure it’s working correctly.

Why Install GA4 Manually?

  • It gives you full control over the installation.

  • You can customise where and how GA4 is implemented.

  • It’s suitable for websites without easy integrations.

Whether you choose to use Google Tag Manager, a platform integration, or install GA4 manually, setting up GA4 is a straightforward process that will give you valuable insights into your website’s performance.

For more tips on optimising your GA4 setup, check out our Mastering Google Analytics 4 Setup: Check List + 10 Best Practices for 2023 blog. Select the method that best suits your needs and technical comfort level, and you’ll be on your way to unlocking actionable data.

If you need further assistance or have any questions, feel free to get in touch—we’re here to help!

rotating_orange_square_giphy

Like this blog post?

Sign up to our email newsletter – Lab Report – and never miss a new one!