•  
  •  

How to Add Google Analytics to WordPress (With and Without a Plugin)

how to add Google Analytics 4 to your WordPress website

Here are instructions on how to add Google Analytics 4 to WordPress that’ll save you lots of headaches. If you’re reading this article, you either have no clue how to do it or you’re torn between adding it via a plugin or without. Don’t you despair. We’re here to guide you through this process.

So what is Google Analytics 4?

Your regular Google Analytics is all about tracking your website’s performance. Google Analytics 4 is exactly that with a few added cherries on top. For example, this new version includes features such as cross-platform (web and app) tracking, AI-generated recommendations, and an enhanced Firebase data model that allows you to track your users based on their “events” that are now called “hits” instead of the previous model based on sessions and pageviews.

Having cleared this up, let’s tackle the next important question:

Why is adding Google Analytics 4 to your website so important?

Google Analytics 4 helps you track the performance of all your marketing campaigns ranging from paid advertising and influencer marketing to SEO in a more efficient and detailed manner. Overall,

  • there’s a stronger emphasis on user journeys;
  • a user-friendly interface;
  • enhanced analysis, reports, and data presentation;
  • easier tracking.

In a nutshell, all of this allows for content improving, making it easier for you to reach your target audience.

Convinced? Let’s get rolling.

Those of you who are interested in more details, we haven’t forgotten about you. Check out this article.

How to add Google Analytics to WordPress

Before we explore our two options for adding Google Analytics to WordPress, let’s take care of two important questions first:

Should you add Google Analytics with or without a plugin?

People usually assume that whichever option allows them to use fewer plugins is necessarily the right choice. Now while this is partly true – some low-quality plugins can slow down your website – it doesn’t apply to this case.

For one, there’s no direct correlation between the number of plugins used and a website’s speed. That’s just a myth. Second, there are millions of plugins out there that are optimized for high performance.

More specifically, here are 3 reasons why adding Google Analytics to WordPress without a plugin isn’t recommended:

  • Difficulty: The process of adding Google Analytics to your website via a plugin is way easier and faster than if you do it manually.
  • Loss of tracking code: There’s a chance you forget to add your tracking code to a new theme, risking that your data won’t be tracked for the time you were running your website without the code. A plugin takes care of that for you.
  • Fewer features: Features such as events tracking, download tracking, and so on are way easier to set up via a plugin. Without one, making use of these additional features can be very time-consuming, and eventually, make you avoid using them altogether.

2. How to create a Google Analytics 4 account

Before you can add Google Analytics 4 to your WordPress website you first need to create an account. So if you haven’t done that yet, make sure to do it now and head back for more instructions.

  1. Head over to Google Analytics and log into your Google account.
  2. Select Start measuring, then enter your business’s or website’s name in the Account Name field. Check all the boxes below and then click Next.
  3. Next, enter your property name, select your currency and time zone, and then click Next one more time.
  4. Now select your industry, indicate your business size, and check all the intentions that apply. Hit the Create button.
  5. Read the GDPR and other terms before accepting them by checking the box and clicking I Accept.

And that’s all there is. That’s how you create a Google Analytics 4 account. Now you can start building your data stream by entering your URL and giving it a name. Right after you’ll receive a measurement ID that will allow you to track your data.

How to add Google Analytics 4 to WordPress via a Plugin

how to add Google Analytics to WordPress with a plugin
We’d like to share two options for adding Google Analytics 4 via a plugin.

Option 1: Adding Google Analytics 4 using the “Insert Headers and Footers” plugin

  1. Log in to your WP dashboard, head to Plugins → Add New, and enter “insert header and footer” in the search bar. (Note: We at 10Web like to use this plugin, but, of course, there are other viable options you can use, such as GA Google Analytics.)
  2. Hover over Settings and click Insert header and footer. Now you’ll need to enter your Google Analytics code into the header of your website to be able to connect your Google Analytics 4 account.
  3. To get this code, sign in to your Google Analytics 4 account, click Admin in the left-side menu, then Data Streams. Next click on the data stream of your website, scroll down, and click “Global site tag (gtag.js).” The body text is your code. Copy it and enter it into the header, then click Save.

That’s it! Google Analytics 4 now has access to your website’s performance.

Method 2: How to add Google Analytics 4 to WordPress using “Monsterinsights”

connecting GA4 to WordPress via MonsterInsights
MonsterInsights doesn’t work with Google Analytics 4, since it’s not updated yet. But it being a popular plugin specifically made for Google Analytics, we’ve decided to include its setup for the previous Google Analytics version to demonstrate its ease of use.

To use the MonsterInsights plugin, just follow the first step as described above.

Once you have activated the plugin, select the category of your website (Business, Blog, eCommerce), then click Save and Continue. After this, you’ll get welcomed by the setup wizard, which you can skip.

Then, you can connect Monsterinsights to your WordPress by adding your license key. The license key can be found in your email receipt or in the account section of the plugin website.

After entering the license key your account gets verified and you can click Connect MonsterInsights. Next, you need to connect Google Analytics to MonsterInsights by choosing the Google account you want to continue the authentication with. Then you have to read MonsterInsights’ terms and give them permissions by clicking Allow. After that, choose a profile to connect to your Google Analytics account, then hit the Complete Connection button.

Once you’ve done all of this, you can set up the plugin.

Difference between the plugins “MonsterInsights” and “Insert Headers and Footers”

  1. It’s incredibly easy to use and saves a lot of time.
  2. It’s a plugin that’s specifically made for Google Analytics, which is why it has a ton of extra features that’ll help you track website traffic, events, eCommerce purchases, add-to-charts, registrations, etc. more precisely. It only takes a simple copy-and-paste of the tracking ID to connect to WordPress, making it a delight, especially for eCommerce owners.

On the other hand, the “Insert Headers and Footers” plugin can be used for adding other tracking codes to your website, for example, Facebook Pixel, Mixpanel, Hotjar, and so on.

This covers the main difference between the plugins MonsterInsights and Insert Headers and Footers. The latter isn’t Google Analytics-specific and doesn’t offer the same range of features.

The second (temporary!) difference is that as of now MonsterInsights isn’t Google Analytics 4 compatible. It has yet to update its functionality, so until that happens we suggest you opt for other plugins that don’t have this deficiency, such as Insert Headers and Footers.

How to add Google Analytics 4 to WordPress Without a Plugin

how to add google analytics four to wordpress without a plugin
Next to adding Google Analytics 4 to WordPress via a plugin, users have the option to insert the Google Analytics code into their theme, making the use of yet another plugin unnecessary.

Interested? Let’s take a look:

  1. Go to your WordPress dashboard, head over to Appearance → Theme Editor, and on the right-side menu, click Theme header.
  2. Enter the Global site tag (gtag.js) code from your Google Analytics 4 account right before.
  3. Then click Update File and, voila, Google Analytics 4 is connected to your WordPress.

FAQs

How do I add the Google Analytics Dashboard to my WordPress website?

You can use a WordPress plugin to see the Google Analytics data on your WordPress admin page. For example, you can try 10WebAnalytics (shameless self-promotion, we know) or the official plugin Site Kit by Google, Beehive, MonsterInsights, and many more.

What is the best Google Analytics plugin for WordPress?

MonsterInsights. But we’d like to repeat: for Google Analytics 4, you’ll just have to be patient and wait for the update. (In the meantime, you can use Insert Headers and Footers and see if that does the trick for you as it does for us.)

But back to MonsterInsights, we weren’t kidding when we said that this plugin was a favorite. It’s a beloved tool for users that want to spare themselves the headache of a complicated and time-consuming setup of Google Analytics.

Plus, it doesn’t hurt that they provide an impressive list of features that make performance tracking more efficient:

  • An extensive report on visitors (including their location, gender, device, etc.)
  • Details on how visitors found your site
  • A Form addon that allows you to track your form views, submissions, and conversion rate.
  • GDPR compliance via the EU Compliance addon

And this is only half of it. The plugin is free but you have the option to upgrade to the premium versions that start at $99.50/year.
To find out more, check out their website.

Now that you’ve added Google Analytics to WordPress, read more about the 8 pivotal agency metrics you should track next.

Don't forget to share this post!

Rebecca Ohanes
Rebecca Ohanes is a content writer at 10Web. She’s a part-time PhD student and a full-time WordPress enthusiast. As an act of goodwill, she refrains from giving a humorous or ironic description of herself. You’re welcome!

Leave a comment

Your email address will not be published. Required fields are marked *

Your email address will never be published or shared. Required fields are marked *

COMMENT

NAME *

WEBSITE

Cancel reply