How to Implement Google Analytics 4 on Website

Cody Schneider

Switching to Google Analytics 4 isn't optional anymore, which means it's time to add the tracking code to your website. Getting started can feel like a technical chore, but it’s more straightforward than you might think. This guide will walk you through the entire process, whether you're using Google Tag Manager, a plugin on your CMS, or adding the code directly to your site.

What You Need Before You Start

Before you get into the setup process, let's make sure you have everything you need. This will make the next steps much smoother.

  • A Google Account: You need a standard Google Account to sign up for Google Analytics. Any Gmail address will work.

  • Website Access: You'll need admin-level access to your website's backend. This could mean access to your site's HTML files, an administrator account for your content management system (CMS) like WordPress or Shopify, or an account for Google Tag Manager.

Finding Your GA4 Measurement ID

No matter which installation method you choose, you’ll first need to find your Measurement ID, which is a unique identifier for your GA4 property that directs the tracking data to the right place, such as G-9860641.

Step-by-Step Instructions

If you don't have a Google Analytics 4 property yet, you'll need to create one first.

  1. Log in to Google Analytics and navigate to the Admin section by clicking the gear icon in the bottom-left corner.

  2. In the Property column, click Create Property. Enter your business name, time zone, and currency.

  3. Next, set up a "Data Stream," which is a source of data - in this case, your website. Select web because it will be your website you are connecting to.

  4. Enter your website URL (e.g., www.myperfectstore.com) and give your stream a name (e.g., "Main Website"). Leave "Enhanced measurement" enabled, as it automatically tracks important actions like file downloads and user interactions.

  5. If everything looks good, click Create stream.

  6. An Installation instructions window will appear with options to install manually or through a website builder or CMS.

Scroll down and expand Install manually. Your Measurement ID will pop up as G-..., and view tag instructions with a code from the data stream details.

Always copy this ID exactly as it appears and paste it into a safe place for now. Now you're ready to choose your installation method.

How to Install the Google Analytics 4 Tag

You have three main options for adding the GA4 tag to your website: using Google Tag Manager, using a CMS-specific plugin, or installing the code manually. Each has its advantages.

  • Google Tag Manager (GTM): Recommended for flexibility and scalability. It acts as a container for all your website's marketing and analytics tags, saving your developers time with updates.

  • CMS Plugins (e.g., WordPress, Shopify): Best for a straightforward tool to make things easier. This is the simplest way for people who use CMS platforms because there's hardly any code.

  • Manual Installation: This method requires directly editing your website's HTML. It can sometimes be the quickest if you don't want another account to manage, though it has pros and cons.

Let's walk through each one.

Method 1: Google Tag Manager (Recommended)

You'll need GTM already installed, so we will walk through setting your tracking code through a tag.

Step 1: Set Up & Configure Tag

  1. Navigate to your Google Tag Manager Workspace, go to the Tags section, and click New.

  2. Give your new tag a clear name, like GA4 Main Tag, so it's easier to troubleshoot later.

  3. Click inside Tag Configuration and look for Google Analytics: GA4 Configuration to set up the Tag Type.

  4. Paste the Measurement ID from GA4 into the Measurement ID box. Configure additional settings if needed.

  5. Underneath the Tag Configuration box, edit Triggers to fire on all your website's pages. Choose Initialization - all pages.

  6. Press Save to finalize your configuration.

  • The Initialization trigger ensures nothing interferes with your tag firing on the page.

Step 2: Submitting Changes to Go Live 🚀

After saving, a popup will show your container from the workspace. Submit it to go live.

  1. Click Submit at the top.

  2. Add a version description (e.g., GA tag configured for all settings) and click the publish button to push the change to production. You can revert to previous setups if needed later.

Step Three: Verifying That This Worked

  • Use the GA realtime reports to check for new activity on your pages. This ensures everything is working.

  • Navigate to Reports > Realtime dashboard in Google Analytics to view recent activity from your web users.

Preview & debug with Google Tag Manager to verify everything works as expected on live sessions.

  1. The draft container should have GA Main Property tags configured. Use the Debugger to verify.

  2. Provide the final address or URLs during debugging to ensure everything is functioning correctly.

  3. The summary of changes, including firing confirmation, indicates successful configuration.

Method 2: Manual Configuration

If you prefer simplicity, this method lets you paste the code directly, avoiding tags or containers management.

  1. In the admin settings, find Install directly to get the HTML snippet for manual installation.

  2. Copy and paste the code into the <head> tag of all relevant pages.

  3. Save the changes or settings as required.

Method 3: Using Content Manager Plugins

Using a WordPress plugin allows you to set up global tags quickly without editing headers manually.

Step 2: Choosing Your WordPress Plugin

Most popular plugins have similar functionality for integrating the measurement ID easily.

  • Google Analytics plugins like MonsterInsights simplify connection setup.

  • Site Kit by Google offers automatic configuration, syncing accounts with OAuth.

Check if GA4 is Connected To Your Website

Realtime Report

  • Open Google Analytics with your new property selected. The real-time report shows mapping for active accounts, helping test the setup.

Tag Assistant

  • Use Chrome's Tag Assistant to verify if the GA4 tags are correctly configured.

Final Check

Remove any old Universal Property tags to prevent duplicate tracking.

Final Thoughts

Setting up GA4 tracking is a fundamental step to understanding your audience and measuring what works. By following these steps using Google Tag Manager, platform-specific integrations, or manual setup, you gain access to the data needed for making smarter business decisions. The initial effort pays off once you start gathering valuable visitor behavior data from your property dashboard.

Once you’ve collected that data, the real challenge is turning it into something meaningful. Typically, data is manually reported, copied, and visualized for meetings, which can be time-consuming. At Graphed, we connect directly to your Google Analytics and other data sources, offering real-time views and simplifying dashboard creation for business insights.