How to add google analytics code to WordPress website?

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:
add google analytics code to wordpress website
add google analytics code to wordpress website
  • Then on the next screen, click on + Create Account
add google analytics to wordpress website
add google analytics to wordpress website
  • On the next screen, in the Account Setup, provide an Account name like the below:
best way to add google analytics to wordpress
Add google analytics to WordPress
  • 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.
how to connect google analytics to wordpress website
How to connect google analytics to wordpress website
  • 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.
What are the best way to add google analytics to wordpress
Best way to add google analytics to WordPress
  • Then in the About your business, choose the Industry category. Then choose Business Size.
how to link wordpress to google analytics
how to link wordpress to google analytics
  • 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.
how to connect google analytics to wordpress websites
Connect google analytics to wordpress websites
  • 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.
how to connect google analytics with wordpress
Connect google analytics with wordpress
  • Then select the Universal property and then click on Open.
add google analytics to wordpress
add google analytics to WordPress
  • 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.
add google analytics to wordpress plugin
add google analytics to wordpress plugin
  • 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.
how to add google analytics to wordpress with a plugin
how to add google analytics to wordpress with a plugin
  • 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).
how to install google analytics on wordpress free
how to install google analytics on wordpress free
  • 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:

  • How to delete GA4 Property in Google Analytics

Leave a Comment