How to Add Google Analytics to WordPress Without a Plugin

- Advertisement -

Looking for a way to add Google Analytics to your WordPress website without a plugin? Adding Google Analytics to your site helps you track your website traffic and gives valuable insights about your visitors. Let’s take a look at how to add Analytics tracking code to your site without a plugin.

Is It Best to Add Google Analytics With or Without a Plugin?

You might think that the fewer plugins you use on your site the better, but that’s not always necessarily true.

It’s true that badly coded plugins could add bloat and slow down your site.

But a well-made, lightweight plugin can save you a lot of time and hassle, without any ill effects.

In fact, the number of plugins on a WordPress site has actually next to no direct correlation with your site’s speed and performance. It’s all about the quality of the plugins installed. The larger plugins for WordPress, like MonsterInsights, which have millions of installs, are more tested and optimized for speed. They have no impact on site load speed whatsoever.

Add Google Analytics in WordPress Without a Plugin

Before we get started, make sure to backup your WordPress theme, so in case something goes wrong, you can easily revert it back.

You’ll be directly editing the code that outputs your site, so a mistake as small as a misplaced comma could bring down your whole site. Be sure to make a backup just in case.

Step 1: Get Your Google Analytics Tracking Code

Log into your Google Analytics account and select the website for which you need the tracking code.

google-analytics-property

Click on Admin in the left taskbar or Setting Icon.

google-analytics
google-analytics

 

In the property column, click Tracking Info, and then Tracking Code.

tracking-code
tracking-code

Now you can get the tracking code under the Website tracking section. Just copy it.

google-download-tracking-code
google-download-tracking-code

Step 2: Add the Tracking Code to the header.php file

Log in to your WordPress dashboard and navigate to Appearance » Editor. Now click the header.php file on the right-hand side below the Templates section.

how to add google analytics in wordpress
how to add google analytics in wordpress

Paste the tracking code you just copied from your Analytics profile before the closing </head> tag. 

insert-code-into-theme-header
insert-code-into-theme-header

Then click Update File.

That’s it!

You’ve just added Google Analytics in WordPress without a plugin.

 

helpless minorityYou May Also Like

Error: View cf868acl2n may not exist

- Advertisement -
Mr Nawaz
Helpless Minority Nonprofit News is only possible with consistent support from the community we proudly serve. Your sustaining contribution of $10 per month (or more) makes you a member, and gets you our print edition.

Latest news

- Advertisement -
- Advertisement -
- Advertisement -

Related news

- Advertisement -

LEAVE A REPLY

Please enter your comment!
Please enter your name here