+91 91635 98888 [email protected] 9, S. N. Banerjee Road, Kolkata

How to Add Google Analytics to Your WordPress Website Without Any Plugin

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 website without any plugin.

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

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

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

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 is all about the quality of the plugins installed.

Before we jump in, let’s take a look at why adding Google Analytics to your site without a plugin may not be the best choice for your site.

  • Not as easy: Adding Google Analytics to your site without a plugin is not at all easy and also not recommendable. With Google Analytics plugin for WordPress, you can easily set up Analytics with just a few clicks.
  • You may lose tracking code: When you switch your themes, you may forget to add the Analytics tracking code again to your new theme. But if you have a plugin for this, you will not loose your google analytics tracking code and will also not any traffic data.
  • You miss powerful Analytics features: You’ll miss powerful features like events tracking, custom dimensions, file download tracking, and more. Without a plugin, it’s very time consuming to set up these features on your WordPress website.

With Google Analytics Plugin, you can easily set up these advanced tracking features with just a few clicks:

  • Enhanced eCommerce tracking for your WooCommerce and Easy Digital Downloads stores
  • Google AdSense tracking so you can see who’s clicking on your ads
  • File download tracking to see how many times each file is downloaded
  • Popular post tracking so you can see which posts are most popular with your audience

…and much more.

If you still want to setup Google Analytics without any plugin, follow the step by step guide below.

Adding Google Analytics code in WordPress Website Without Any 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.

click on google analytics view

Click on Admin in the left taskbar.

click admin

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

get google analytics tracking-code

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

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.

add-to-header-file

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

Then click Update File.

That’s it!

You’ve just added Google Analytics code in your WordPress Website without any plugin.

After installing Google Analytics, you might also want to stop Google Analytics from tracking logged in WordPress users. For more tutorials like this, follow us on Twitter and Facebook.

Leave a comment

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