How to Add Google Analytics 4 to WordPress


Google Analytics is a powerful tool that provides website owners with valuable insights into their website’s performance and user behavior. Google Analytics 4 (GA4) is the latest version of this analytics platform, offering enhanced tracking capabilities and improved data analysis. If you have a WordPress website and want to leverage the benefits of GA4, this article will guide you through the process of adding GA4 to your WordPress site.

how to add Google Analytics 4 to WordPress

Creating a Google Analytics 4 Property

To get started, you need to create a Google Analytics 4 property for your website. Follow these steps:

  • Sign into your Google Analytics account or create a new one if you don’t have an account yet.
  • Once logged in, click on the “Admin” tab at the bottom left corner of the screen.
  • In the “Property” column, click on the dropdown menu and select “Create Property.”
  • Choose the “Web” option and enter a name for your property, such as your website name.
  • Fill in the relevant information about your website, such as the URL and industry category.
  • Click on the “Show Advanced Options” link and enable the “Create a Universal Analytics property” option. This will allow you to use both GA4 and Universal Analytics tracking.
  • After filling in the required information, click on the “Create” button to create your GA4 property.

Setting Up Google Analytics 4 in WordPress

Now that you have created your GA4 property, the next step is to integrate it with your WordPress website. Here’s how you can do it:

Method 1: Using a Plugin

  • In your WordPress dashboard, go to “Plugins” and click on “Add New.”
  • Search for the “Google Analytics 4” plugin and install it.
  • Once the plugin is installed, click on the “Activate” button to activate it.
  • Go to the plugin’s settings, which can usually be found under “Settings” or “Analytics” in your WordPress dashboard.
  • Enter your GA4 Measurement ID in the provided field. You can find this ID in your Google Analytics account by going to Admin > Property > Data Streams > Web > Stream Details.
  • Save the changes, and the plugin will start tracking your website with GA4.

Method 2: Manual Integration

If you prefer not to use a plugin, you can integrate GA4 manually by adding the tracking code to your WordPress theme. Follow these steps:

  • In your Google Analytics account, go to Admin > Property > Data Streams > Web > Stream Details and copy the Measurement ID.
  • Access your WordPress theme files either through an FTP client or the theme editor in your WordPress dashboard.
  • Locate the header.php file in your theme. This file is usually found under “Appearance” > “Editor” > “Theme Header.”
  • Open the header.php file and find the <head> section.
  • Paste the GA4 tracking code snippet just before the closing </head> tag.
  • Save the changes, and GA4 will start tracking your website.


Adding Google Analytics 4 to your WordPress website is essential for understanding your website’s performance and user behavior. By following the steps outlined in this article, you can easily integrate GA4 with your WordPress site. Whether you choose to use a plugin or integrate it manually, Google Analytics 4 will provide you with valuable insights to optimize your website and improve user experience. Start tracking your website today and unlock the power of GA4!

At Akeans, we are dedicated to helping our clients succeed online. If you are interested in learning more about Our Google Analytics UA to GA4 migration services for WordPress Sites, Please don’t hesitate to contact us for a consultation. Our team of experts would be more than happy to answer any questions you may have and provide you with all the information you need to make an informed decision.