How to Add Google Analytics to WordPress (2 Easy Ways)
You can add Google Analytics to WordPress in two ways. Use Analytify, a WordPress plugin that needs no code. Or add the Google Analytics 4 (GA4) tracking code or Google Tag Manager manually.
Both methods start the same way. You create a GA4 property and a web data stream in Google Analytics. Then you either connect that property through Analytify or paste the tracking code into your site.
Google Analytics 4 is Google’s free analytics tool. Once GA4 runs on your WordPress site, it records visitors, traffic sources, top pages and conversions. You see what brings people to your site and what they do there.
Pick your method by skill level. Beginners should use Analytify. Analytify connects GA4 through a Google sign-in. It shows GA4 reports inside the WordPress dashboard. Developers who want full control can add the tracking code by hand or manage it in Google Tag Manager.
Table of Contents
Use Analytify if you want the fastest setup without code. Analytify adds the GA4 tracking code for you. It shows your reports in WordPress. You never need to open a separate Google Analytics tab.
Use the manual method if you are comfortable editing site code. Adding GA4 without Analytify gives you full control over where and how the tracking code loads.
Both methods are covered step by step below, with a screenshot for each screen in Google Analytics and WordPress.
How to Add Google Analytics 4 to Your WordPress Site?
Add Google Analytics 4 to your WordPress site with Analytify (no code). Or add it manually with the tracking code or Google Tag Manager (copy and paste). Here is how the two options compare:
- With Analytify, a WordPress plugin. This is the best option if you don’t code or want the quickest setup.
- Without a plugin, by adding the tracking code yourself. This option suits users who are comfortable with code.
I. Add Google Analytics to WordPress with Analytify
To add Google Analytics to WordPress through Analytify, follow three steps. Create a GA4 property and install Analytify. Then sign in with Google and select your property. The steps below cover each screen.
Note: If you’ve already set up the GA4 property, skip the next steps. Move directly to Step 4.
Step 1: Sign up for Google Analytics
Visit Google Analytics and sign up with your Google account if you don’t already have a Google Analytics account.
Click Set up for free.

- Type in the details about your website that is asked for, then click Next.
- Pick Web as the platform and click Next.
- Fill in the required information about your website (URL, name, etc.) and click Create.
To integrate Google Analytics with WordPress, you first need to create an account. Learn how to set up a Google Analytics account here.
Step 2: Set up a GA4 Property
Set up a GA4 property from the Admin area of Google Analytics. Choose your account and click Create property. Then add your property and business details. Skip this step if your site already has a GA4 property.
In your Google Analytics account, go to the bottom left area and click the Admin button.
Choose the account you want to use from the Account section.
Click the Create property. See the below picture to follow these steps.

Fill in the property Name and click on Next. It can be the name of your website or business.

Fill in Business Information and click on Create.

After clicking Create, you’ll be redirected to the Data Stream page.
Choose your platform for the data stream. In our case, we choose Web as the platform.

Step 3: Set Up the Data Stream
Set up a web data stream by entering your website URL and a stream name, then clicking Create.

Click the Web on the Data Streams page. You’ll be navigated to Web Stream Page.
See Installation Instructions by clicking on View Tag Instructions.

Choose Install with a website builder or CMS if you use Analytify. Analytify adds the GA4 tag for you once you connect your Google account in Step 6. You do not need to copy this code.

Step 4: Install Analytify, the WordPress Plugin, and Turn It On
Install Analytify from your WordPress dashboard. Go to Plugins >> Add New and search for Analytify. Then click Install Now and Activate.

You’ll be navigated to a new page. Type Analytify into the search bar to find it, as shown in the picture below.

Find the Google Analytics Dashboard Plugin for WordPress by Analytify in the search results. Click Install Now. Click Activate when the installation is done.
Step 5: Install and Activate Analytify Pro
Install Analytify Pro by downloading the Pro add-ons from your Analytify account. Upload each one under Plugins >> Add New >> Upload Plugin. This step is optional. The free version of Analytify connects GA4 and shows core reports. WordPress.org lists it as Google Analytics Dashboard Plugin for WordPress by Analytify. Analytify Pro adds more reports and add-ons.
To unlock every Analytify Pro feature, buy a plan on the Analytify pricing page.
For an in-detail guide, read How to Install And Activate Analytify Pro Plugin.
After purchase, you would be provided with license keys and add-ons. You can download these add-ons, as shown in the picture below.

After downloading these add-ons, go back to your WordPress site. Add them by navigating to Plugins>>Add New>>Upload Plugin>>Install Plugin.

Activate each add-on after you install it. Repeat the upload and activation steps for every Analytify add-on.
Step 6: Connect Analytify to Google Analytics
Connect Analytify to Google Analytics by signing in with your Google account. Go to Analytify >> Settings >> Authentication. Then select your GA4 property. Analytify Pro users add their license keys first. The license keys are in the Analytify account you used to buy Analytify add-ons.

Now, go to Analytify>>Settings on your WordPress homepage.
Click the License tab and add license keys.

After adding the license keys of all add-ons, navigate to the Authentication tab.
Click the button that says Log in with your Google Account to link Analytify to your Google Analytics account.

You’ll be navigated to the next page. There, choose an account to continue with Analytify.

When asked, give the rights that are needed. And click on Allow, as shown in the picture below.

Once you’ve connected properly, you’ll be navigated back to the Analytify settings page. From the dropdown menu, click the Profile tab. Choose the Google Analytics profile (property) you want for your WordPress site. Then click Save Changes.

Step 7: Set up More Settings
Set up more settings in the other Analytify settings tabs. For example, you can stop certain user roles from being tracked or turn on better eCommerce tracking.
Step 8: Check to See If Google Analytics is Working
Check that Google Analytics is working. Open your site in a private window. Find your visit in the GA4 Realtime report. If the setup is correct, the Realtime report shows at least one active user.
You can also verify this in your WordPress Dashboard by navigating to Analytify>>Dashboards.

All done! With the help of the Analytify tool, you have successfully added Google Analytics to your WordPress site. You can now track your website’s traffic, user behavior, and other key metrics. Use your WordPress dashboard or the Google Analytics platform.
After Google Analytics is set up on your WordPress site, you can get GA4 reports in your inbox. Learn how to set up and customize Google Analytics email reports to track your key metrics every week.
II. Add Google Analytics to WordPress Without a Plugin
You can add Google Analytics to WordPress without Analytify in two ways. Paste the GA4 tracking code into your site header. Or load GA4 through Google Tag Manager.
Method 1: Integrate Google Analytics and WordPress Manually with Code
To add Google Analytics to WordPress manually, copy the Google tag from your GA4 data stream. Paste it into the header of your site. You only need to copy and paste the code.
Follow these steps to add the GA4 tracking code directly to your WordPress site:
Step 1: Get the GA4 code for Tracking
Get the GA4 tracking code from the Data Streams section of your Google Analytics Admin area. Sign in to your Google Analytics account first.
Click the Admin tab in the bottom-left area.
Choose the account you want to use in the Account section.
Choose the GA4 property you made for your WordPress site in the Property field.
Click Data Streams in the Property box.
Follow the below picture:

Pick the Web data stream that is connected to your website. Click on the data stream. You’ll be navigated to Webstream details and Tag Instructions
Click on View Tag instructions and scroll down the page.

Click on Install Manually and copy the code given for tracking.

Step 2: Add the Tracking Code to Your WordPress Site
Add the tracking code to WordPress. Paste it into the Scripts in Header box of the Insert Headers and Footers plugin. Log in to WordPress and install Insert Headers and Footers first if your site does not have it.
To install Insert Headers and Footers, go to Plugins >> Add New. Type Insert Headers And Footers in the search bar. Click Install Now. Follow the image below.

Now, under the Tools, navigate to Settings>>WP Headers and Footers.

In the Scripts in the Header part, paste the whole tracking code that you copied from Google Analytics.
Scroll down the page and click Save. The Google Analytics 4 tracking code now loads on every page of your WordPress site through Insert Headers and Footers. GA4 starts recording visits.
Step 3: Make Sure the Link Works
Check the connection. Visit your site in a new tab and find your visit in the GA4 Realtime report. Go back to your Google Analytics account and click Realtime in the left menu. If your visit appears, GA4 is tracking your site.

Method 2: Add Google Analytics to WordPress with Google Tag Manager
To add Google Analytics to WordPress with Google Tag Manager (GTM), install the GTM container code on WordPress. Then create a GA4 tag inside GTM. GTM suits sites with several tracking codes, because every tag lives in one place. Here is the step-by-step setup:
Step 1: Make an Account for Google Tag Manager
Make a Google Tag Manager account by going to Google Tag Manager and signing in with your Google account. If you don’t have a GTM account yet, click Create Account and fill in the details.
Set up a new container for your website. Give it a name and select Web as the platform to target.
Click Create and agree to the service terms.

You will be given the GTM as shown in the picture below.

The Install Google Tag Manager window opens by itself after you create a container. If you close the window by accident, reopen it under Admin >> Install Google Tag Manager.

After clicking on Install Google Tag Manager, you’ll be navigated to the Google Tag Manager Tab.

Copy both tags to add into WordPress site.
Step 2: Add the Tracking Code to Your WordPress Theme
Add the GTM container code to your WordPress theme with the Insert Headers and Footers plugin. The code has two parts: one for the header and one for the body. Log in to your WordPress dashboard to start.
If you don’t have installed Insert Headers And Footers plugin, you would first need to add this Plugin.
To install Insert Headers and Footers, go to Plugins >> Add New. Type Insert Headers And Footers in the search bar. Click Install Now. Follow the image below.

Under the Tools, navigate to Settings>>WP Headers and Footers.
Copy and paste the first part of the GTM container code. It sits inside the <head> tags. Paste it in the box of Script in Header.

Copy and paste the second part of the GTM container code. It sits inside the <body> tags. Paste it in the Script in the Body box.
Scroll down the page and click Save to keep the changes you’ve made.
Step 3: Set up the GA4 tag in GTM
Set up the GA4 tag in GTM. Create a new tag with your GA4 Measurement ID and the All Pages trigger. Open your Google Tag Manager account to start.
Click Tags in the menu on the left and then New.

Give your tag a name, such as GA4 testing Tag, and click Tag Configuration.
Pick Google Analytics: GA4 Configuration from the list of tag types.

In the Measurement ID field, put your GA4 property’s Measurement ID (G-XXXXXXXXXX).
You can find this ID in your Google Analytics account. Click Admin, then Data Streams. Then choose the data stream.

Click on Triggering and choose All Pages, which is the usual Page View trigger. This makes sure that the GA4 tag works on all of your website’s pages. Click Save to finish setting up the tag.

Step 4: Publish the GTM Container
Publish the GTM container by clicking Submit in the top right corner of your GTM workspace.

Give the container version a name and a description, then click Publish. Publishing makes your GA4 tag live on every page of your site.

Step 5: Make Sure the Connection Works
Check the connection. Visit your site in a new tab and find your visit in the GA4 Realtime report.
Go back to your Google Analytics account and click on Realtime in the menu on the left.
Look to see if your visit is in the report. If it is, the link is set up right.

Summary: The Easiest Way to Add GA4 to WordPress
The easiest way to add Google Analytics to WordPress is the Analytify plugin. Create a GA4 property, install Analytify, sign in with Google, and select your property. Developers can add the GA4 tracking code manually or through Google Tag Manager instead.
Whichever method you choose, check the GA4 Realtime report after setup to confirm your visits are tracked. Have a question about your setup? Ask in the comments below.
Next, read Google Analytics Events vs. Goals (Simple Guide) and How to Track Facebook Ads in Google Analytics 4.
Not using Analytify yet? See every GA4 report inside WordPress with Analytify Pro.
Frequently Asked Questions
Does Google Analytics work with WordPress?
Yes, Google Analytics is compatible with WordPress. In fact, it works with almost any CMS, such as Joomla, Drupal, or Magento.
By integrating it with a plugin in your blog or business website, you can easily get the data in the WordPress dashboard.
Do I need to put Google Analytics code on every page?
No. You add the Google Analytics code once, in the head section of your site, and WordPress loads that header on every page. Analytify, a header scripts plugin, or Google Tag Manager all place the GA4 code in the head section for you.
Is Google Analytics a plugin?
No. Google Analytics is a free web and app analytics tool from Google, not a WordPress plugin. You can install Google Analytics in WordPress with a plugin such as Analytify, which adds the tracking code and shows GA4 reports in your dashboard.
Can you set up Google Analytics for multiple websites with the same Google account?
Yes. One Google account can hold several GA4 properties, one for each website. In Google Analytics, go to Admin and click Create property for each new site. Each WordPress site then connects to its own GA4 property through Analytify or its own tracking code.
Why is Google Analytics not showing data on my WordPress site?
Google Analytics usually shows no data because the tracking code is missing, loaded twice, or blocked. Make sure only one method adds the GA4 tag (Analytify, a header scripts plugin, or Google Tag Manager, not two of them). Clear your cache plugin and turn off ad blockers while you test. The Realtime report should show your own visit within a minute, while standard GA4 reports can take 24 to 48 hours to fill.
Is Google Analytics 4 free to use on WordPress?
Yes. Google Analytics 4 is free for most websites, including WordPress sites. Google also sells Google Analytics 360, an enterprise version with higher data limits, for large companies. See the full breakdown in Google Analytics pricing. Analytify has a free version on WordPress.org and Pro plans from $99 per year.



Any update on the Analytify plugin’s compatibility with Google Analytics GA-4?
It is already compatible with GA4 since Analytify 5.0 version.
Check out the changelog
I tried to connect Google analytics code to the wordpress using insert Header and Footer plugin. But when i verify it said “verification unsuccessful”. Please help me to solve it.
Thank you for the clear and concise instruction. Was able to get this done without yet another plugin
applied the code manually and it’s working perfectly to my website, thanks a lot for your assistance!
By any chance using the Brave browser couldn’t be a problem to see the analytics?
Hello, Tayyab, great job on creating such an amazing and informative article! I think in my opinion, Adding the analytics using a plugin is the best way as you will never lose the code when you update the theme and they also offer you a wide range of options with rich additional features.
Thank you for sharing this blog. It’s really helpful.
Hey Tayyab, I am glad that I found your blog thanks for sharing this article. I was really searching for some information like this. Thanks for sharing this blog. I got all the information that I was looking for.
You are Welcome, Priya Sharma 🙂
Hello
When I click selected Profile for posts nothing shows up, it is already difficult. I don’t know what to do to get google analytics code inside the website. Thank you very much.
That might be because you created a GA4 account instead of a UA property. GA4 accounts don’t show up in the profile drop-down because Google hasn’t updated its API yet. You need to create a Universal Analytics property.
Check this article here.
Hello Davy
Thank you so much for helping me, you have solved my problem. It is working now, the way I really need it. Thank you very much!
Hello
I have had so much trouble selecting Profile for posts, nothing shows up here, I cannot select nothing from it. In order to used google analytics I must give a code or call a code from this plugin. But it didn’t show me an option, What should I do?
Thank you in advance
Jennifer
Your blog is really good.I have learned so many things from your blog.
Hi! I just have a question, I entered the Google Analytics code in the header.php part but… wouldn’t that be erased when you update the theme?…
Nope, Only the functions.php file will be updated
Your blog is very informative.I have learned so many things about Google Analytics from your blog.
Thank you