Are you wondering how to add Google analytics code to WordPress website? It is easy, I will show you here step by step, how to add google analytics to WordPress with a plugin.
Once you connect google analytics to the WordPress website, you can see the number of users visiting your website, how many sessions, what is the bounce rate, and how many active users are there on your website now.
You can also see, your visitors by country, and how many users visit from different devices like desktops, Mobile, Tablet, etc. You will be able to get a lot more information from your Google Analytics.
So, if you are a new website owner, make sure to connect google analytics to your website and also, How to Submit Site to Google Search Console.
You may also like to see, a niche site case update on how to make money from a niche website.
How to add google analytics to WordPress with a plugin
Now, let us see, step by step, how to add google analytics to WordPress with a plugin.
- Open Google Analytics (Sign in with your Gmail id) and then click on Admin like below:

- Then on the next screen, click on + Create Account

- On the next screen, in the Account Setup, provide an Account name like the below:

- Then in the Property setup step, provide a Property name. Choose the Reporting time zone, Currency, etc.
- Then click on the Show advanced options to expand it.

- This will help us to create both Google Analytics 4 and the Google Analytics Universal property. Use the Toggle button to enable it and then provide the Site URL. Choose one from the below options:
- Create both a Google Analytics 4 and a Universal Analytics property: This allows us to create both properties. Choose this option here.
- Create a Universal Analytics property only: Choose this option if you want to just create the Universal property. But according to Google, they will stop collecting data from 1st July 2023 onwards. So better is to create both properties.
- Then click on Next.

- Then in the About your business, choose the Industry category. Then choose Business Size.

- Then click on the Create button, here it will ask to accept the “Google Analytics Terms of Service Agreement”. Check the checkbox and click on the I Accept button.

- Now the property got created and next, we need to add the tracking code to the website. The property will be displayed below. Here if you will click on the dropdown, you can see both the properties.

- Then select the Universal property and then click on Open.

- Now, we need to get the tracking code and add the code to the WordPress website. Here click on the Settings icon (down corner), then click on the Tracking Info -> Tracking Code.

- Here, you can see the tracking javascript code (Global Site Tag (gtag.js)). Copy this code and we need to add this code to our website.

- This code needs to be added inside the <head> tag on all the pages on our website. So for this, we will use a Free WordPress plugin. The plugin name is “WPCode – Insert Headers, Footers, and Code Snippets“
- If you have not added this plugin, then simply click on Plugins -> Add new and search for WPCode and you will get this plugin. Install and Activate the plugin.
- Then the plugin will be available in the left navigation, from where we can use it to add scripts or codes to the Header & Footer.
- Click on Code Snippets -> Header & Footer. And then add in the Header section, paste the copied code (That we have copied from Google Analytics).

- Then Click on the Save button. Now we have added the tracking code and Google will start collecting website user details.
This is how to add google analytics to WordPress with a plugin.
Conclusion
I hope you got an idea on how to add google analytics code to WordPress website. Once you connect google analytics to WordPress websites, you can see the visit details that Google will keep tracking for us.
So, if are building a new website, make sure to add google analytics to WordPress with a plugin, so that we can use the free SEO tool Google Analytics to measure our website performance.
You may also like:

I am Hannah, an online entrepreneur based in New York, United States. As the founder of several successful niche websites, I got the expertise in areas such as making money online, blogging, YouTube, affiliate marketing, and more. Through this website and blog posts, I am trying to provide insightful and actionable tips to help aspiring entrepreneurs, find ways to make money online. Read more.