Are you wondering about how to add Google Analytics to WordPress without using a plugin?

If you are not using Google Analytics for your website then you are missing a lot of valuable insight about your visitors.

Since Google Analytics tracks all the important data about the visitors, it will help you understand your visitors in a better way and create your user experience and marketing strategy accordingly.

With WordPress, it is very easy to set up Google Analytics by choosing one of the different plugins.

However, in some cases,

  • non-handy and badly coded plugins can slow down your website.
  • might sometime create a compatibility issue with the existing theme and plugins
  • may affect your site performance in the wrong way
  • may create security loopholes

In this situation, you might want to not use a plugin and rather set it up manually.

Here I will show how you can set up Google Analytics manually in a very easy way without using any plugins.

Just follow these steps:

  • Go to Google Analytics and login with your Gmail.
  • Click on Create Account
  • Fill up your account name and click next
  • From the options select, what do you want to measure
  • Fill up the website name, website URL, category, and time zone.
  • Finally, click create button
  • You will be prompted a set of website tracking code something like this
analytics tracking code

Now once you have generated the analytics tracking code, you need to add this code into your WordPress website. For this

  • login into WordPress admin and go to the dashboard.
  • navigate to appearance and then to editor.
adding analytic code in the theme

On the right side click on file header.php under the theme files.

adding the code in the header file

Now paste your google analytics code before the closing </head> tag.

NOw, click update file and That’s it!

This was all about adding Google Analytics code to WordPress without using WordPress plugins. Are you using Google Analytics on your website? Share your thoughts in the comment.


You may also like : 

How to load your WordPress website faster by optimizing the images


Sparkle Theme Editorial team includes a group of passionate writers, editors, and bloggers who actively write on different topics related to Wordpress, SEO, Web hosting, eCommerce, and many more.

Leave a Reply

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