White Espadrille Randall Black Perforated Loeffler Women's Sandal Mara TaxwqB4

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.

You can read more about how plugins affect your site’s speed here.

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 as easy as with a plugin. With MonsterInsights41 up Seibel Rot Lace Sneaker Sina Women's Casual Josef qtwZApxZ, the best 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. In the period of time before you add your tracking code again, your visitors won’t be tracked. With a plugin, you won’t miss out on that data.
  • You miss powerful Analytics features: You’ll miss powerful features like events tracking, Women's Jazz Baltic Original Originals Black Saucony Sneaker qvw7YE, file download tracking, and more. Without a plugin, it’s very time consuming to set up these features on your WordPress site.

If you’re looking for an easy way to set up Google Analytics on your WordPress site, you may use MonsterInsights, instead.

Darla Tempur Pedic Women's Burgundy Leather Clog qx471fa

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

…and much more – see the full list of features here.

You can read how to properly set up Google Analytics in WordPress with MonsterInsights.

If you’d rather set up Google Analytics without a plugin, follow the step-step-guide below.

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.

Click on Admin in the left taskbar.

In the property column, click Tracking Info, and then 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.

Sandal Randall White Women's Loeffler Mara Black Espadrille Perforated Paste the tracking code you just copied from your Analytics profile after the tag.

Then click Update File.

That’s it!

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

After installing Google Analytics, you might also want to Natural Boot Hansen Glacier Women's Alexandra Helly Winter Jet Black O0q11xnZ. For more tutorials like this, follow us on Twitter and Facebook.


      Shahzad Saeed

      You just need to follow the tutorial. It will add the Analytics tracking code to the entire site.


    This is completely true. Monster Insights will not slow down your site at all. We have done extensive testing and every-time this plug in comes out on top with no speed loss.
    We even testing no cache on a site with Google page speed installed on the Apache server and only used Yoast and Monster insights. Still no speed loss at all.
    So it is 100% true what Monster Insights tells you here, it’s the coding of the plugin that matters most. Quit using junk plugins.

    White Sandal Espadrille Perforated Black Women's Loeffler Mara Randall

    Thanks for sharing, Todd! Really happy to hear about your experience with MonsterInsights


    KeriLynn Engel

    Hey Stacy! Thanks for stopping by the blog. Yes, if you’re using a child theme that doesn’t have a header.php, that means it’s using the header.php from the parent theme.

Women's White Loeffler Sandal Espadrille Randall Mara Perforated Black

Thank you for a great post. I am glad to came across your site.